Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm struggling to get my vector layer working. The wfs works as I have tested it by creating a wfs layer and adding it to the map, now I'm trying to display a vector layer with the results of a search but nothing is showing up. The results of the search appear in the gridpanel but not in the vector layer. Here is the code for the search:

var features = [];
var wfs = new OpenLayers.Layer.Vector("Search");
var select = new GeoExt.grid.FeatureSelectionModel();

var protocol = new OpenLayers.Protocol.WFS({
    url:  "http://localhost:8080/geoserver/wfs",
featureType: "location_points",
featureNS: "",
geometryName: "the_geom"

formPanel = new GeoExt.form.FormPanel({
title: "Species Search",
height: 150,
region: "north",
protocol: protocol,
items: [{
    xtype: "textfield",
    width: 200,
    name: "scientific__like",
    fieldLabel: "name",
    allowBlank: false,
    minLength: 4
listeners: {
    actioncomplete: function(form, action) {
        features = action.response.features;
            wfs = new OpenLayers.Layer.Vector("Search");
buttons: [{text: 'search',
    handler: function(){;
keys: [{ key: [Ext.EventObject.ENTER], 
    handler: function() {;

Firebug shows the following error: is null; (FeatureSelectionModel.js (line 174))

I followed an example on line ( I appologise if someone has already asked this, I've looked everywhere for the answer and found nothing, I'm quite new to this, so any help would be very much appreciated.



share|improve this question
up vote 6 down vote accepted

Looking at your code you either need to:




You have map.addLayers(wfs), which is incorrect, I believe.

share|improve this answer
It works! much appreciated! – Will Feb 20 '12 at 17:35
@Will : Give the_skua credit and mark this question as answered by clicking on the check mark next to this answer. :) – CaptDragon Feb 20 '12 at 18:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.