[OpenLayers-Users] Limit features returned by hover event on Vector Layer?

Planet)x andrew.stewart at reddeer.ca
Thu Mar 3 12:22:33 EST 2011


I am trying to make a "mouseover" event on a vector layer display just the
data from the feature beneath that layer itself. I am using a BBOX strategy
but with the below code the test_hydrants.features is around 300 features
long since this is how many are returned in the current BBOX. My question is
can I somehow determine or return only the feature that is underneath my
mouse during the event, and get the attributes from that feature?

 //Hydrant
   var test_hydrants = new OpenLayers.Layer.Vector("Hydrant", {
   
                minScale : 5000,
                maxScale : 99,
                styleMap: new OpenLayers.StyleMap(style_vector),

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

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

        test_hydrants.events.register('mouseover',test_hydrants,function(e)
{
        alert(test_hydrants.features);  -- this returns all the features in
the BBOX.. how can I get just the one under the mouse?
        });
       

       //Add Vector Layers to Map
       map.addLayer(test_hydrants);

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Limit-features-returned-by-hover-event-on-Vector-Layer-tp6085625p6085625.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list