[OpenLayers-Users] Unable to see WFS layer created by GeoServer

Jorge Gustavo jgr at di.uminho.pt
Thu Sep 15 02:33:21 EDT 2011


Hi Robin,

1)
Try to see if this URL works:
http://vmfiddich:8081/geoserver/RobinTest/wfs?service=WFS&version=1.0.0&request=DescribeFeatureType&typeName=RobinTest:datazones_2001

2)
Get the xmlns:RobinTest location from the result, to put the same 
location in featureNS

3) Use something like:
var wfs = new OpenLayers.Layer.Vector("Datazones 2001", {
	strategies: [new OpenLayers.Strategy.BBOX()],
	protocol: new OpenLayers.Protocol.WFS({
		version: "1.1.0",
		url: "http://vmfiddich:8081/geoserver/wfs",
		featureType: "datazones_2001",
		featureNS: "location from step 2)",
		geometryName: "the_geom",
		schema: 
"http://vmfiddich:8081/geoserver/RobinTest/wfs?service=WFS&version=1.0.0&request=DescribeFeatureType&typeName=RobinTest:datazones_2001",
	})
});

3.1)
Right now, you don't need to specify a style. OL will use the default 
style. Later, when it works, put your own style. Keep it simple as 
possible for now.

4)
In Firebug, check if the request is being done

5)
If not, or just in case, use a local proxy to ensure you are not using 
different domains, ié
OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url=";

6)
Check once more the WFS post request and answer in Firebug

Good luck,

Jorge


On 14-09-2011 09:03, Boyle Robin wrote:
> Hello list!
>
> I am having difficulty adding a WFS layer that was created using
> GeoServer.  i am using OpenLayers.Layer.Vector with WFS protocol.  When
> I add a layer to OpenLayers from the WMS equivalent, it is fine.  My
> code is below.  The layer datasource is a shapefile called
> datazones_2001 which resides in the RobinTest workspace.
>
> ==========================================================
> var wfsLayer = new OpenLayers.Layer.Vector("Datazones 2001", {
>
>                  strategies: [new OpenLayers.Strategy.BBOX()],
>
>                  protocol: [new OpenLayers.Protocol.WFS({
>
>                          url:
> "http://vmfiddich:8081/geoserver/RobinTest/ows"
>
>                          ,featureType: "RobinTest:datazones_2001"
>
>                          , featureNS:
> "http://vmfiddich:8081/geoserver/data"
>
>                          , version: "1.0.0"
>
>                  })],
>
>                  styleMap: new OpenLayers.StyleMap({
>
>                  strokeWidth: 3
>
>                  ,strokeColor: "#333333"
>
>                  })
>
>
> })
>
> map.addLayer(wfsLayer);
>
>
> =========================================================
>
> When I preview the layer in GeoServer as GML it produces valid GML.  Any
> ideas???
>
> Thanks in advance,
> Robin
>
> Robin BOYLE
> IT Consultant (GIS)
> Sopra group.	
> Orchard Brae House
> 30 Queensferry Terrace
> Edinburgh EH4 3ER
> Phone : (DDI) +44 (0)131 311 6604 - (Office) +44 (0)131 332 3311
> Mob : 07736 664 619
> rboyle at uk.sopragroup.com - www.sopragroup.co.uk
> <http://www.sopragroup.co.uk/>
> P Before printing, think about the environment.	
>
>
> IMPORTANT NOTICE: This message is intended for the addressee only. The content
> may be confidential, legally privileged and protected by law. Unauthorised
> use, copying or disclosure of any of it may be unlawful. If you are not the
> intended recipient please notify the sender and remove it from your system.
> Internet emails are not necessarily secure.  Although we have taken steps to
> ensure this email and attachments are free from any virus, we advise that in
> keeping with good computing practice you should ensure they are actually virus
> free. The right to monitor email communications through our network is
> reserved by us.
>
> Sopra Group Limited (Registered in England, No. 1588948) with Registered
> Offices at: Middlesex House, Meadway Technology Park, Rutherford Close,
> Stevenage, Hertfordshire, SG1 2EF.  VAT No. 366 9784 84.
>
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users


-- 
Jorge Gustavo Rocha
Departamento de Informática
Universidade do Minho
4710-057 Braga
Tel: 253604430 (Geral), 253604479 (Gabinete)
Fax: 253604471
Móvel: 910333888


More information about the Users mailing list