After some debugging, I figured out some of the problem. It's due to the axis order spec in WFS 1.0 versus WFS 1.1. On the GML feature geometry in my app, originally x was assigned the latitude and y was assigned the longitude. I changed my WFS version in the GetFeatureRequest to WMS 1.0 from 1.1 and it works! Next question is how do I specify that WFS version in the OpenLayers.WFS constructor? I tried the same syntax as in my GetFeatureRequest params with no success.
David A. Hollema GIS Analyst United Power, Inc. -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of David Hollema Sent: Wednesday, April 08, 2009 12:48 PM To: Andrea Aime Cc: [email protected]; [email protected] Subject: Re: [OpenLayers-Users] [Geoserver-users] wfs, state plane,and spherical mercator Here is my code. WMS reprojects fine b/c my understanding is geoserver receives the base map projection (900913) and reprojects accordingly. I would figure that geoserver would do the same thing to the WFS but it doesn't. My SRS handling in geoserver is set to force declared (default setting) and my declared is correct, 2231 in this case. For WMS, it's not even necessary to set the srs in the layer constructor b/c geoserver just figures it out. It's important to note that I even tried with my source data in 4326 (lat/long) and WMS still worked fine but WFS fails. It doesn't seem to be due to State Plane issues but it's more fundamental than that. var bounds = new OpenLayers.Bounds (-20037508.34, -20037508.34, 20037508.34, 20037508.34); var options2 = { units: 'm', projection: 'EPSG:900913', maxExtent: bounds }; format = 'image/gif'; map2 = new OpenLayers.Map('map2', options2); velayer = new OpenLayers.Layer.VirtualEarth( "VE", { 'type': VEMapStyle.Roads, 'sphericalMercator': true}); layerWMS = new OpenLayers.Layer.WMS( "Joint Use Photos", "http://upigis:8080/geoserver/wms", {layers: 'sde:jointusepicture', format: format, transparent: true }, {opacity: 1.0, isBaseLayer: false, 'singleTile': true }); layerWFS = new OpenLayers.Layer.WFS( "Joint Use Photos WFS", "http://upigis:8080/geoserver/wfs", { typename: "sde:jointusepicture"}, {extractAttributes: true} ); David A. Hollema GIS Analyst United Power, Inc. -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Andrea Aime Sent: Tuesday, April 07, 2009 1:36 AM To: David Hollema Cc: [email protected]; [email protected] Subject: Re: [OpenLayers-Users] [Geoserver-users] wfs, state plane,and spherical mercator David Hollema ha scritto: > Here's my dilemma. I have a map with projection defined as spherical > Mercator, EPSG 900913. I have a geoserver WMS layer whose native > projection is state plane Colorado north (EPSG 2231). With help from > the lists, I'm able to overlay the WMS fine on a Virtual Earth map. > When I add a new WFS layer (pointing at the same geoserver data) using > similar constructor as the WMS, the WFS layer does not overlay fine, > it's shifted way off. That's problem 1. I can't figure out how to get > the WFS to overlay. Please share the request you're making. The WFS and WMS reprojection syntaxes are not equal. Also, what is the SRS handling you chose in your feature type configuration? > Next question. I want to recenter the map based on a feature created > from a separate WFS request. I use OL.Format.GML and the read method > to create a new feature from the responseXML. When I look at the > geometry of the point feature, the x,y cords are in the native > coordinates. I tried point.transform("EPSG:2231","EPSG:900913") but the > transformation never works properly. All the examples I see go from > 4326 to 900913. My data are in State Plane. I would expect that the > underlying transformation library could handle this transformation but > maybe not? You can also have GeoServer do the reprojection for you. You just have to add &srsName=EPSG:900913 to your request, keeping the eventual bbox in 2231, or have the bbox in 900913 too, but state it explicitly with &bbox=x0,y0,x1,y1,EPSG:900913 Cheers Andrea -- Andrea Aime OpenGeo - http://opengeo.org Expert service straight from the developers. _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
