[OpenLayers-Users] [Geoserver-users] wfs, state plane, and spherical mercator

David Hollema dhollema at UnitedPower.com
Wed Apr 8 14:48:17 EDT 2009


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: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org]
On Behalf Of Andrea Aime
Sent: Tuesday, April 07, 2009 1:36 AM
To: David Hollema
Cc: users at openlayers.org; geoserver-users at lists.sourceforge.net
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
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users



More information about the Users mailing list