[OpenLayers-Users] Conversion of BBox for GetFeature Request

Arnd Wippermann arnd.wippermann at web.de
Thu Mar 7 10:33:41 PST 2013


Hi,

I have tried your selectClick declaration, but i doesn't work. But if I add
a line from
the selectBox declaration I use, it doses work.

Try with : this.setModifiers(...
Why this works, i really don't now. Perhaps without this, it causes an
error, and stops the rest. 


    selectClick: function(evt){
        var bounds =
this.pixelToBounds(evt.xy).transform(this.map.getProjectionObject(), new
OpenLayers.Projection('EPSG:4326'));
        this.setModifiers(this.handlers.box.dragHandler.evt);
        this.request(bounds, {single: this.single});
    },


You have to add something else to your code:

myControl.events.register("featureselected", this, function(e) {
        e.feature.geometry.transform(new
OpenLayers.Projection('EPSG:4326'),this.map.getProjectionObject());
        highlightLayer.addFeatures(e.feature);

}); 

because the request gets the feature not in the map projection. You have to
reproject it.

And last but perhaps not important, how I add my control (i use MapServer as
mapserver):

    WFSfromWMSLayerOptions = {
        version:"1.0.0",
        geometryName: 'msgeometry',
        maxFeatures: 100,
        srsName:new OpenLayers.Projection('EPSG:4326'),
        filterType: OpenLayers.Filter.Spatial.BBOX
    };

    control = new OpenLayers.Control.myGetFeature({
            protocol: OpenLayers.Protocol.WFS.fromWMSLayer(lyr1,
WFSfromWMSLayerOptions),
            box: true,
            click: true,
            single: false,
            clickTolerance: 10
        });

Good Luck,
Arnd



-----Ursprüngliche Nachricht-----
Von: openlayers-users-bounces at lists.osgeo.org
[mailto:openlayers-users-bounces at lists.osgeo.org] Im Auftrag von Jerome A.
Wendell
Gesendet: Donnerstag, 7. März 2013 02:55
An: 'Phil Scadden'; openlayers-users at lists.osgeo.org
Betreff: Re: [OpenLayers-Users] Conversion of BBox for GetFeature Request

Phil,

Thanks.  I will give that a try.  I have not used the debug version before,
but I will set it up to use that.


-----Original Message-----
From: openlayers-users-bounces at lists.osgeo.org
[mailto:openlayers-users-bounces at lists.osgeo.org] On Behalf Of Phil Scadden
Sent: Wednesday, March 06, 2013 8:41 PM
To: openlayers-users at lists.osgeo.org
Subject: Re: [OpenLayers-Users] Conversion of BBox for GetFeature Request

Use lib/Openlayers version (debug) so you can debug into OL source code, and
set breakpoint in the select: function in getfeatures.js Step through this
and see if it sheds any light.

Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.

_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users

_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users



More information about the Users mailing list