Thanks Phil!  I was finally able to get it working.  Turned out I was just 
being impatient - trying to do things with the filtered layer before it had 
finished loading, so of course it was returning undefined.  

So this is what I ended up with:

found_layer = new OpenLayers.Layer.Vector(
        'Inventory Points',
        {
                strategies: [new OpenLayers.Strategy.Fixed()],
                displayInLayerSwitcher: false,
                protocol: new OpenLayers.Protocol.Script({
                        url:'http://gismgr:8080/geoserver/wfs',
                        callbackKey: 'format_options',
                        callbackPrefix: 'callback:',
                        params: {
                                service: 'WFS',
                                version: '1.1.0',
                                srsName: 'EPSG:3857',
                                request: 'GetFeature',
                                typeName: 'Inventory_Points',
                                outputFormat: 'json',
                                cql_filter: filter
                        }
                })
        }       
);

Then later:

map.addLayer(found_layer);

found_layer.events.register('loadend', found_layer, function() {
        found_feature = found_layer.features[0];
        if (found_feature===undefined) {
                alert("No such resource, please try again.");
        } else {
                map.setCenter(found_feature.geometry.bounds.getCenterLonLat());
                map.zoomToExtent(found_feature.geometry.bounds);
                }
        }
);

So anyway, now I feel kinda silly, but thanks for the help anyway!  Hopefully 
this can save someone else a little time in the future.

Kat
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to