Searching Feature Layer By its Attribute

Here's the screenshot 'coz I'm not good at explaining.
A pop up will show if the feature layer is found, it is also selected.

Here's the link for displaying Popups.

Here's the code below for reference:
Supposed your Vector Layer name is "layer_agao" and your SelectFeature Control is "selectControl".

            for (var f = 0; f < layer_agao.features.length; f++) {
                if (layer_agao.features[f].attributes.newpin == this.value) {
                    featsel = layer_agao.features[f];

This should be placed inside your "init()" function in which it is called as the body loads.

And for the HTML markup:

{% csrf_token %}
<select name="q" class="form-control" id="forminput">
  <option type="text" value=""><b>Select Land PIN</b></option>
  {% for getlandpins in query_map %}
       <option type="text" value="{{ getlandpins.newpin }}">{{ getlandpins.newpin }}
  {% endfor %}
<input type="button" class="btn btn-primary" value="Show Info" id="mybutton">

You just need to change the IDs depending on your JQuery code.
That's all! :D

Popular posts from this blog

Add/Subtract Single Digit Number in Assembly Language

Set table width to 100% on PDF export in Datatables