[OpenLayers-Users] Coordinates Reversed

Jerome A. Wendell jawendell at digitalmapping.com
Mon Mar 11 12:57:41 PDT 2013


I have setup a vector layer based on features from a WMS layer that are
filtered by an argument in the url used to call up the map.  The feature is
being found and shows up in the POST response in Firebug, but does not show
up on the map.  My first thought was the feature needed to be transformed,
so I added that.  In looking at the response in Firebug for the feature, the
latitude is listed before the longitude.  This appears to be my problem
because the coordinates listed for the feature in the DOM in Firebug are not
realistic (contain NaN a number of times).  The code for that part of my map
is below:

var args = OpenLayers.Util.getParameters();

                                var filter = new
OpenLayers.Filter.Comparison({

                                                type:
OpenLayers.Filter.Comparison.EQUAL_TO,

                                                property: 'attribute',

                                                value: args['attribute']

                                });

                                var selvectorLayer = new
OpenLayers.Layer.Vector("Selected Tract", {

                                                strategies: [new
OpenLayers.Strategy.Fixed()],

                                                protocol: new
OpenLayers.Protocol.WFS.fromWMSLayer(mylayer),

                                                styleMap: mystyles,

                                                filter: filter,

                                                displayInLayerSwitcher:
false,

                                                isBaseLayer: false,

                                                visibility: true,

                                                eventListeners: {

                                                beforefeatureadded:
function(event) {

 
event.feature.geometry.transform(new
OpenLayers.Projection('EPSG:4326'),this.map.getProjectionObject());

                                                }

                                                }

                                });

The WMS layer is in EPSG:4326, and the map is in EPSG:900913.  I have tried
a number of things, such as adding format: new OpenLayers.Format.GML({xy:
false}) to the vector layer, but the order of the coordinates does not
change.  I have a control for selecting features from this same WMS layer,
and when those features are returned, the coordinates are listed longitude
and then latitude.

 

Obviously I am missing something.  Can someone point me in the right
direction to find out why the coordinates are reversed?

 

Any suggestions are greatly appreciated.

 

Thanks.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130311/69930349/attachment.html>


More information about the Users mailing list