[OpenLayers-Users] Box from GetFeature control, can this be polygon?

Planet)x andrew.stewart at reddeer.ca
Tue Apr 12 11:31:25 EDT 2011


Using the GetFeature example code it is working fine, except I need to be
able to use a polygon to select features instead of the default blue box,
can this be done? I tried to modify the openlayers box handler inside the
control to use Polygon instead and it did change to polygon but now it
doesn't select the features properly, appreciate any advice.

Here is my working code with the blue box I need to be a polygon - 

  //Create Vector layer for selection
                var select = new OpenLayers.Layer.Vector("Selection",
{styleMap: 
                new
OpenLayers.Style(OpenLayers.Feature.Vector.style["select"])
                });
                
                map.addLayer(select);
                
                //WFS 1.0.0 (for GeoMedia WebMap 6.0)
                var protocol = new OpenLayers.Protocol.WFS({
                url: wfs,
                featureType: "WEB_Parcels",
                featureNS: "http://www.intergraph.com/geomedia/gml",
                featurePrefix: "gmgml",
                srsName: "EPSG:3776",
                geometryName: "Geometry",
                version: "1.1.0"
                });
                
                //Create GetFeature control - add/activate
                var control = new OpenLayers.Control.GetFeature({
                protocol: protocol,
                box: true,
                hover: false,
                id: 'select_feature',
                multipleKey: "shiftKey",
                toggleKey: "ctrlKey",
                maxFeatures: 1
                });
                control.events.register("featureselected", this, function(e)
{
                array_select.push(e.feature.attributes.Orig_AddrKey);
                select.addFeatures([e.feature]);
                alert(array_select.length);
                });
                control.id = 'select_feature';
                map.addControl(control);
                control.activate();

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Box-from-GetFeature-control-can-this-be-polygon-tp6265591p6265591.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list