[OpenLayers-Users] Problem with OpenLayers.Protocol.WFS from Geoserver

Sarah Schuessler sarah_flip at yahoo.de
Fri Jun 11 10:06:03 EDT 2010


Hi,

for example at geoserver giu you have Namespace topp then you have to declare http://www.openplans.org/topp as featureNS. If you have further problems I think best way is to use the geoserver mailinglist.

Have you used pro4j for your epsg:2180 because OL doesn`t support this? 

HTH
best regards
Sarah


________________________________


 Hi,



________________________________
Von: >Bartłomiej Burkot <pomiarowiec10 at poczta.onet.pl>
>An: users at openlayers.org
>Gesendet: Freitag, den
>11. Juni 2010, 11:12:53 Uhr
>Betreff: >[OpenLayers-Users] Problem with OpenLayers.Protocol.WFS from Geoserver
>
>>Dear users
>
>>Can somebody tell me why is the vectorlayer: "WFS stops from protocol 
>>WFS" in this examle not displaying?
>http://mapakrakow.pl/~bbarni/mk4/index2.php
>
>>I defined 2 Vector layers both from geoserver:
>>First as "OpenLayers.Layer.WFS" the sercond as
>"OpenLayers.Layer.Vector" 
>>with "OpenLayers.Protocol.WFS".
>>As I can see in firebug the respond from geoserver is the same GML-file
> 
>>at both Layers but at "protocol.WFS" the stops are not displaying in
>the 
>>map.
>>I tryed change the version of protocol, strategy, stylemap, add the 
>>geoserver url to proxy.cgi and nothing helped.
>
>>Under is my code.
>>Can somebody explain me what I'm doing wrong? How to change 
>>OpenLayers.Protocol.WFS to request the goeserver with GET method
>instead 
>>of POST?
>>Thanks
>>Bartek
>
>
>>wfs = new OpenLayers.Layer.WFS(  "WFS from Layer.WFS",    
>>"http://mapakrakow.pl:8080/geoserver/wfs",
>>                    {typename: 'komunikacja:przystanki_mk'},
>>                    {
>>                        typename: "komunikacja:przystanki_mk"
>>                    }
>>                );
>>var przystanki_wfs = new OpenLayers.Layer.Vector("WFS stops from 
>>protocol WFS", {
>>                        strategies: [new OpenLayers.Strategy.BBOX()],
>>                        //strategies: [new OpenLayers.Strategy.Fixed()],
>>                          projection: new 
>>OpenLayers.Projection("EPSG:2180"),
>>                        styleMap: styleMap1,
>>                        protocol: new OpenLayers.Protocol.WFS({
>
>>                            version: "1.0.0",
>>                            srsName: "EPSG:2180",
>>                            url:  
>>"http://mapakrakow.pl:8080/geoserver/wfs",
>>                            featureNS: "komunikacja", //featureNS: 
>>"komunikacja",
>>                            //featureNS: 
>>"http://localhost:8080/komunikacja", //featureNS:
>"komunikacja", 
>>"http://mapakrakow.pl:8080/komunikacja"
>>                            featureType: "przystanki_mk",
>>                            geometryName: "the_geom",
>>                            featurePrefix:"komunikacja",
>
>>                            extractAttributes: false
>>                            
>>//schema:"http://mapakrakow.pl:8080/geoserver/wfs?service=WFS&version=1.1.0&request=DescribeFeatureType&typeName=komunikacja:przystanki_mk"
>>                        })
>>                    });
>
>>_______________________________________________
>>Users mailing list
>Users at openlayers.org
>http://openlayers.org/mailman/listinfo/users
>
>


> 
>Hi,
>
>>AFAIK
>you have to use featureNS with original namespace and not the short one
>and WFS can´t do GET (but I´m not sure of this one). 
>
>>HTH
>>best regards
>>Sarah
>
>
>
When I change featureNS to
featureNS: "http://mapakrakow.pl:8080/komunikacja"
I get the error from firebug: 

Could not locate {http://mapakrakow.pl:8080/komunikacja}przystanki_mk in catalog.
I cannt find the featureNS parameter in my Geoserver configuration. My
layer is defined in geoserver in workspace "komunikacja", layername is
przystanki_mk, EPSG is 2180. Geoserver has correctly computed
Bounding Boxes from data. Geometry columns name is the_geom,
type: Point.
Geoserver has generated layer preview:
http://mapakrakow.pl:8080/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=komunikacja:przystanki_mk&styles=&bbox=545448.688,226900.375,586247.75,261943.359&width=512&height=439&srs=EPSG:2180&format=application/openlayers 

From where should I read the featureNS?

My GML file (respond from geoserver WFS) generated as
OpenLayers.Layer.WFS works correctly and looks like:

<?xml version="1.0" encoding="UTF-8"?>
<wfs:FeatureCollection xmlns="http://www.opengis.net/wfs" 
xmlns:wfs="http://www.opengis.net/wfs" 
xmlns:komunikacja="http://localhost:8080/komunikacja" 
xmlns:gml="http://www.opengis.net/gml" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://localhost:8080/komunikacja http://mapakrakow.pl:8080/geoserver/wfs?service=WFS&amp;version=1.0.0&amp;request=DescribeFeatureType&amp;typeName=komunikacja%3Aprzystanki_mk http://www.opengis.net/wfs http://mapakrakow.pl:8080/geoserver/schemas/wfs/1.0.0/WFS-basic.xsd">
<gml:boundedBy><gml:null>unknown</gml:null></gml:boundedBy>
<gml:featureMember><komunikacja:przystanki_mk fid="przystanki_mk.1195">
	<komunikacja:name>N.M.P.</komunikacja:name>
	<komunikacja:idkomunika>180</komunikacja:idkomunika>
	<komunikacja:a_t>a</komunikacja:a_t>
	<komunikacja:the_geom><gml:Point srsName="http://www.opengis.net/gml/srs/epsg.xml#2180">
		<gml:coordinates xmlns:gml="http://www.opengis.net/gml" decimal="." cs="," ts=" ">573280.14256993,244164.45815782</gml:coordinates>
		</gml:Point></komunikacja:the_geom>
	<komunikacja:klucz>n.m.p.</komunikacja:klucz></komunikacja:przystanki_mk>
</gml:featureMember><gml:featureMember><komunikacja:przystanki_mk fid="przystanki_mk.1257">
	<komunikacja:name>M1 Nowohucka</komunikacja:name>
	<komunikacja:idkomunika>114</komunikacja:idkomunika>
	<komunikacja:a_t>a</komunikacja:a_t>
	<komunikacja:the_geom><gml:Point srsName="http://www.opengis.net/gml/srs/epsg.xml#2180">
		<gml:coordinates xmlns:gml="http://www.opengis.net/gml" decimal="." cs="," ts=" ">571810.60532311,244521.74814857</gml:coordinates>
		</gml:Point></komunikacja:the_geom>
	<komunikacja:klucz>m1 nowohucka</komunikacja:klucz></komunikacja:przystanki_mk>
	...

</wfs:FeatureCollection>

Thanks for Your suggestions
Bartek

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100611/4dbf52f9/attachment.html


More information about the Users mailing list