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

Boyle Robin rboyle at uk.sopragroup.com
Thu Sep 15 10:40:32 EDT 2011


Hi Jorge,

I did the steps you prescribed and - hey presto! - I can see my data.  I can pan and zoom as expected.  Everything looks as it should; however...I still have a JavaScript error:

Error: this.layer.protocol.read is not a function
Source File: http://vmfiddich/openlayers-2.10/OpenLayers.js
Line: 1817

Any ideas?

Thanks for your input!!!

Robin

==============================================================

Message: 2

Date: Thu, 15 Sep 2011 00:33:21 -0600

From: Jorge Gustavo <jgr at di.uminho.pt>

Subject: Re: [OpenLayers-Users] Unable to see WFS layer created by

GeoServer

To: openlayers-users at lists.osgeo.org

Message-ID: <4E719C31.7020901 at di.uminho.pt>

Content-Type: text/plain; charset=ISO-8859-1; format=flowed

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 <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 <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 <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 <http://vmfiddich:8081/geoserver/RobinTest/ows> "

>

> ,featureType: "RobinTest:datazones_2001"

>

> , featureNS:

> "http://vmfiddich:8081/geoserver/data <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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110915/451a3ce8/attachment.html


More information about the Users mailing list