[OpenLayers-Users] Conversion of BBox for GetFeature Request
Jerome A. Wendell
jawendell at digitalmapping.com
Wed Mar 6 05:26:24 PST 2013
Gery,
Thanks for the information. I really appreciate your help.
Jerome
From: Gery . [mailto:gamejihou at hotmail.com]
Sent: Wednesday, March 06, 2013 2:38 AM
To: jawendell at digitalmapping.com
Cc: OpenLayers User List
Subject: Re: [OpenLayers-Users] Conversion of BBox for GetFeature Request
It should work using the code below, I did the same (thanks to Greg and Arnd tips), I'm working from memory here but both var should go inside the Openlayers.class
Sent from my iBath
On Mar 6, 2013, at 4:52, "Jerome A. Wendell" <jawendell at digitalmapping.com> wrote:
I failed to add the following to my previous post:
var geographic = new OpenLayers.Projection("EPSG:4326");
var mercator = new OpenLayers.Projection("EPSG:900913");
Thanks.
From: openlayers-users-bounces at lists.osgeo.org [mailto:openlayers-users-bounces at lists.osgeo.org] On Behalf Of Jerome A. Wendell
Sent: Tuesday, March 05, 2013 9:37 PM
To: OpenLayers User List
Subject: [OpenLayers-Users] Conversion of BBox for GetFeature Request
I read several posts on this topic, and have attempted to convert the coordinates of the BBox from 900913 to 4326, which is the system for the layer the GetFeature request is posted for. The request is still being sent in 900913 coordinates, and no features are being returned. I am new to OpenLayers, and I have probably interpreted the information in the posts and the documentation incorrectly. Any suggestions that you may have concerning what I am doing wrong are greatly appreciated. The code that I am using is below:
OpenLayers.Control.myGetFeature = OpenLayers.Class(OpenLayers.Control.GetFeature,{
selectBox: function(position){
var newbounds = new OpenLayers.Control.GetFeature.prototype.selectBox.apply(this, transform(mercator,geographic).toBBox(null,mybaselayer.reverseAxisOrder()));
this.request(newbounds);
},
CLASS_NAME: 'OpenLayers.Control.myGetFeature'
});
var myControl = new OpenLayers.Control.myGetFeature({
protocol: OpenLayers.Protocol.WFS.fromWMSLayer(mylayer),
box: false,
hover: false,
maxFeatures: 20
});
myControl.events.register("featureselected", this, function(e) {
highlightLayer.addFeatures(e.features);
});
myControl.events.register("featureunselected", this, function(e) {
highlightLayer.removeFeatures(e.features);
});
map.addControl(myControl);
myControl.activate();
Thanks in advance for your help.
_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130306/da6176fb/attachment-0001.html>
More information about the Users
mailing list