Leaflet CQL Filter User Input

528 views
Skip to first unread message

Cameron Muller

unread,
Mar 7, 2017, 1:41:47 AM3/7/17
to Leaflet
0 down vote accept
Hi All!

This is my first time posting to the forum and hope I am in the right place!

I have managed to get a cql_filter within my code as below:


var contours = L.tileLayer.wms('http://gis01-dbn:8080/geoserver/Inyaninga_243-198/wms', {
        layers: 'Inyaninga_243-198:contours_3857',
        format: 'image/png',
        transparent: true,
        cql_filter: 'elevation= 126', 
        });
 

Is there however any way to make this elevation parameter receive user input and update?

I have created a form in the html as such:


 <form>
    Elevation(m):<br>
   <input type="text" id="myInput">
   <input type="button" value="Elevation">
</form>
 

However, I am getting stuck with passing "myInput" into the cql_filter to accept a value which the user can enter.

I have tried creating a function housing the cql_filter but again cannot call this into the cql_filter option when loading the WMS.


I am new to the web development side of GIS and any help or pointers in the right direction would be greatly appreciated.

Clay Hill

unread,
Mar 17, 2018, 11:25:14 PM3/17/18
to Leaflet
 Cameron,
Did you ever figure this out?
I have the same question.
I would appreciate your help, if you figured it out.
Thanks
Clay

Cameron Muller

unread,
Mar 19, 2018, 2:30:39 AM3/19/18
to leafl...@googlegroups.com
Hi Clay,

Apologies for the delayed reply.

I did figure this out; however, I did it after shifting across to Openlayers.

I could share the code with you and it may help point you in the right direction if you'd like?

Kind regards,

Cameron Muller
Master of Science: Environmental Sciences
GISc Technician (GT 1770)
072 686 9200


--

---
You received this message because you are subscribed to a topic in the Google Groups "Leaflet" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/leaflet-js/CfyN-ouL7GQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to leaflet-js+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages