I am using the Select Feature example to do so on my WFS layer. The below
code is querying my parcels and returning the geometry which zooms into the
map. For some reason it does not work everytime and I cannot understand why.
Sometimes the geometry of a parcel is returned when I search by the address
name but if I try the address of the parcel right next to it the map zooms
into a default location (the center of the map I think) instead of the
correct geometry and does not put any red square around it. Is there anyway
I can debug this using firebug to see what the geometry is being returned..
and why sometimes this works perfectly fine and others with a different
address name (which is in the format of street name number) does not return
the right geometry. Appreciate any advice.

    var filter;
    var name = 'Query Item';
    var property = 'Orig_AddrKey';
  
    // remove previous query results from map/legend 
    //clearMarker(name);

    // check if OGC attribute filter is used
    if (property && value) 
    {
        // filter based on property=value
        filter = new OpenLayers.Filter.Comparison({
            type: OpenLayers.Filter.Comparison.EQUAL_TO,
            property: property,
            value: value
        });
    }

    //
*****************************************************************************************************
    // Layer style (3 pt redline around parcel)
    //
*****************************************************************************************************
    var style = OpenLayers.Util.extend({},
OpenLayers.Feature.Vector.style['default']);
    style.fillOpacity = 0;
    style.strokeColor = "red";
    style.fillColor = "";
    style.strokeWidth = 3;    
    //
*****************************************************************************************************

    // create an OpenLayers.Layer.Vector layer where WFS 1.1.0 is used to
query feature.
    // GML is then used to fill layer
    var grid = new OpenLayers.Layer.Vector(name, {
    
        displayInLayerSwitcher: false,

        // init style
        styleMap: new OpenLayers.StyleMap(style),

        // init strategy : fixed=WFS query once, Cluster=Point feature group
within a tolerance
        // speeding up drawing process
        strategies: [new OpenLayers.Strategy.Fixed()],

        // WFS 1.0.0 (for GeoMedia WebMap 6.0)
        protocol: new OpenLayers.Protocol.WFS({
            url: wfs,
            featureType: "WEB_Parcels",
            featureNS: "http://www.intergraph.com/geomedia/gml";,
            featurePrefix: "gmgml",
            srsName: "EPSG:3776",
            filter: filter,
            geometryName: "Geometry",
            version: "1.1.0"
        })
    });
    alert(grid);
    map.addLayer(grid);

    //recenter on selection
    grid.events.register("loadend", grid, function() {
        map.zoomToExtent(grid.getDataExtent());
        map.zoomOut();
    });
-- 
View this message in context: 
http://osgeo-org.1803224.n2.nabble.com/Having-issue-with-SelectFeature-on-WFS-layer-not-working-everytime-tp5919510p5919510.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to