[OpenLayers-Users] Re: Can't get WFS to work.

sulu andreas.siegel at vorarlberg.at
Fri Jun 24 06:29:08 EDT 2011


Hi Casper,

thanks for answering.

Are you referring to the proxy.cgi script?
It works well in my case.

mapserver and Openlayers reside on the same physical machine so i doubt i
have proxy issues.

My problem is that nothing gets rendered on the screen.

If one is interested to try the WFS-Service please use:
http://vogis.cnv.at/mapserver/mapserv?map=wfs_test.map&service=wfs&request=getcapabilities
http://vogis.cnv.at/mapserver/mapserv?map=wfs_test.map&service=wfs&request=getcapabilities 

In OL i use that code to glue the WFS-layer into my map:


>     var wfs = new OpenLayers.Layer.Vector("FWP-KG", {
>         strategies: [new OpenLayers.Strategy.BBOX()],
>         protocol: new OpenLayers.Protocol.WFS({
>             url:
> "http://cnvbrwgdit2.net.vlr.gv.at/cgi-bin/mapserv?map=wfs_test.map",
>             featureType: "kg-grenze",
>             featureNS: "http://www.openplans.org/topp"
>         })
>     });
>     map.addLayers([layer, wfs]);
> 




If i call my OL-HTML in Firefox, Firebug shows something like:




> http://cnvbrwgdit2.net.vlr.gv.at/cgi-bin/proxy.cgi?url=http://cnvbrwgdit2.net.vlr.gv.at/cgi-bin/mapserv?map=wfs_test.map&<wfs:GetFeature
> xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.0.0"
> xsi:schemaLocation="http://www.opengis.net/wfs
> http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><wfs:Query
> typeName="feature:kg-grenze"
> xmlns:feature="http://www.openplans.org/topp"><ogc:Filter
> xmlns:ogc="http://www.opengis.net/ogc"><ogc:BBOX><ogc:PropertyName>the_geom</ogc:PropertyName><gml:Box
> xmlns:gml="http://www.opengis.net/gml"
> srsName="EPSG:31254"><gml:coordinates decimal="." cs="," ts="
> ">-195000,112500
> 125000,352500</gml:coordinates></gml:Box></ogc:BBOX></ogc:Filter></wfs:Query></wfs:GetFeature>
> 

So there is some WFS-activity going on.

Mapserver returns some XML-Code like:


> <?xml version='1.0' encoding="ISO-8859-1" ?>
> <wfs:FeatureCollection
>    xmlns:ms="http://mapserver.gis.umn.edu/mapserver"
>    xmlns:wfs="http://www.opengis.net/wfs"
>    xmlns:gml="http://www.opengis.net/gml"
>    xmlns:ogc="http://www.opengis.net/ogc"
>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>    xsi:schemaLocation="http://www.opengis.net/wfs
> http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd 
>                        http://mapserver.gis.umn.edu/mapserver
> http://cnvbrwgdit2.net.vlr.gv.at/mapserver/mapserv?map=wfs_test.map&amp;version=1.1.1&amp;SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAME=feature:kg-grenze&amp;OUTPUTFORMAT=XMLSCHEMA">
>       <gml:boundedBy>
>       	<gml:Box srsName="EPSG:31254">
>       		<gml:coordinates>-60708.899987,189112.439997
> -7238.329998,273190.070001</gml:coordinates>
>       	</gml:Box>
>       </gml:boundedBy>
>     <gml:featureMember>
>       <ms:kg-grenze>
>         <gml:boundedBy>
>         	<gml:Box srsName="EPSG:31254">
>         		<gml:coordinates>-39201.779996,230833.604001
> -34718.157992,236709.662996</gml:coordinates>
>         	</gml:Box>
>         </gml:boundedBy>
>         <ms:msGeometry>
>         <gml:Polygon srsName="EPSG:31254">
>           <gml:outerBoundaryIs>
>             <gml:LinearRing>
>               <gml:coordinates>-36482.179000,236674.556996
> -36470.541992,236673.196001 -36386.308992,236684.556000
> -36373.859996,236672.739997 -36367.460000,236675.189999
> -36680.108992,236608.511999 -36566.858997,236703.756996
> -36560.639997,236709.662996 
> ...
> -36556.016992,236706.866002 -36549.283998,236698.247998
> -36482.179000,236674.556996 </gml:coordinates>
>             </gml:LinearRing>
>           </gml:outerBoundaryIs>
>         </gml:Polygon>
>         </ms:msGeometry>
>       </ms:kg-grenze>
>     </gml:featureMember>
>     <gml:featureMember>
>       <ms:kg-grenze>
>         <gml:boundedBy>
>         	<gml:Box srsName="EPSG:31254">
>         		<gml:coordinates>-40245.269997,220756.769998
> -31109.289998,226623.864000</gml:coordinates>
>         	</gml:Box>
>         </gml:boundedBy>
>         <ms:msGeometry>
>         <gml:Polygon srsName=
> ....
> </quote>
> 
> This seems a sensible replay from mapserver. But, as i said, nothing
> visual happens.
> 
> Cheers
> Andy
> 
> 
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
> 

Casper Span wrote:
> 
> Hi,
> 
> I think you are running against a problem I had as well: the lack of a
> proxy
> / proxy script.
> You can only get WFS data again the same domain. (and thus, the same port
> as
> well)
> 
> So if you're MapServer isn't running on the same domain as your OL page,
> you
> will need a forwarder from the OL code to the Mapserver.
> 
> Something like http://yourwebsite.com/mapserver -->
> http://yourmapserver.com/mapserver
> or http://yourwebsite.com:8080/mapserver -->
> http://yourwebsite.com/mapserver
> 
> Hope this helps!
> 
> regards,
> Casper
> 
> On Wed, Jun 22, 2011 at 3:48 PM, sulu &lt;andreas.siegel at vorarlberg.at&gt;
> wrote:
> 
>> Hi.
>>
>> Yes, i know this topic is far from new but i'm stuck getting my
>> OL-WFS-Test-Client to work.
>> The basic idea it to get the background from a Mapserver-WMS-Service and
>> plot on this some vector-data from a WFS-Layer (also provided by
>> mapserver).
>>
>> WMS works pretty well but WFS won`t.
>>
>> Before i flood this post with code-samples of my mapfiles and/or the
>> OL-HTML-document i would like to ask if there is a walkthrough where it
>> is
>> shown how to code a correct mapfile and the corresponding OL-Code.
>>
>> Or if one could provide me with a working wfs-mapfile and a matching
>> OL-Code
>> i would be very grateful.
>>
>> Thanks in advance
>> Andy
>>
>> --
>> View this message in context:
>> http://osgeo-org.1803224.n2.nabble.com/Can-t-get-WFS-to-work-tp6504309p6504309.html
>> Sent from the OpenLayers Users mailing list archive at Nabble.com.
>> _______________________________________________
>> Users mailing list
>> Users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>
> 
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
> 

Casper Span wrote:
> 
> Hi,
> 
> I think you are running against a problem I had as well: the lack of a
> proxy
> / proxy script.
> You can only get WFS data again the same domain. (and thus, the same port
> as
> well)
> 
> So if you're MapServer isn't running on the same domain as your OL page,
> you
> will need a forwarder from the OL code to the Mapserver.
> 
> Something like http://yourwebsite.com/mapserver -->
> http://yourmapserver.com/mapserver
> or http://yourwebsite.com:8080/mapserver -->
> http://yourwebsite.com/mapserver
> 
> Hope this helps!
> 
> regards,
> Casper
> 
> On Wed, Jun 22, 2011 at 3:48 PM, sulu &lt;andreas.siegel at vorarlberg.at&gt;
> wrote:
> 
>> Hi.
>>
>> Yes, i know this topic is far from new but i'm stuck getting my
>> OL-WFS-Test-Client to work.
>> The basic idea it to get the background from a Mapserver-WMS-Service and
>> plot on this some vector-data from a WFS-Layer (also provided by
>> mapserver).
>>
>> WMS works pretty well but WFS won`t.
>>
>> Before i flood this post with code-samples of my mapfiles and/or the
>> OL-HTML-document i would like to ask if there is a walkthrough where it
>> is
>> shown how to code a correct mapfile and the corresponding OL-Code.
>>
>> Or if one could provide me with a working wfs-mapfile and a matching
>> OL-Code
>> i would be very grateful.
>>
>> Thanks in advance
>> Andy
>>
>> --
>> View this message in context:
>> http://osgeo-org.1803224.n2.nabble.com/Can-t-get-WFS-to-work-tp6504309p6504309.html
>> Sent from the OpenLayers Users mailing list archive at Nabble.com.
>> _______________________________________________
>> Users mailing list
>> Users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>
> 
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
> 

Casper Span wrote:
> 
> Hi,
> 
> I think you are running against a problem I had as well: the lack of a
> proxy
> / proxy script.
> You can only get WFS data again the same domain. (and thus, the same port
> as
> well)
> 
> So if you're MapServer isn't running on the same domain as your OL page,
> you
> will need a forwarder from the OL code to the Mapserver.
> 
> Something like http://yourwebsite.com/mapserver -->
> http://yourmapserver.com/mapserver
> or http://yourwebsite.com:8080/mapserver -->
> http://yourwebsite.com/mapserver
> 
> Hope this helps!
> 
> regards,
> Casper
> 
> On Wed, Jun 22, 2011 at 3:48 PM, sulu &lt;andreas.siegel at vorarlberg.at&gt;
> wrote:
> 
>> Hi.
>>
>> Yes, i know this topic is far from new but i'm stuck getting my
>> OL-WFS-Test-Client to work.
>> The basic idea it to get the background from a Mapserver-WMS-Service and
>> plot on this some vector-data from a WFS-Layer (also provided by
>> mapserver).
>>
>> WMS works pretty well but WFS won`t.
>>
>> Before i flood this post with code-samples of my mapfiles and/or the
>> OL-HTML-document i would like to ask if there is a walkthrough where it
>> is
>> shown how to code a correct mapfile and the corresponding OL-Code.
>>
>> Or if one could provide me with a working wfs-mapfile and a matching
>> OL-Code
>> i would be very grateful.
>>
>> Thanks in advance
>> Andy
>>
>> --
>> View this message in context:
>> http://osgeo-org.1803224.n2.nabble.com/Can-t-get-WFS-to-work-tp6504309p6504309.html
>> Sent from the OpenLayers Users mailing list archive at Nabble.com.
>> _______________________________________________
>> Users mailing list
>> Users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>
> 
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
> 

Casper Span wrote:
> 
> Hi,
> 
> I think you are running against a problem I had as well: the lack of a
> proxy
> / proxy script.
> You can only get WFS data again the same domain. (and thus, the same port
> as
> well)
> 
> So if you're MapServer isn't running on the same domain as your OL page,
> you
> will need a forwarder from the OL code to the Mapserver.
> 
> Something like http://yourwebsite.com/mapserver -->
> http://yourmapserver.com/mapserver
> or http://yourwebsite.com:8080/mapserver -->
> http://yourwebsite.com/mapserver
> 
> Hope this helps!
> 
> regards,
> Casper
> 
> On Wed, Jun 22, 2011 at 3:48 PM, sulu &lt;andreas.siegel at vorarlberg.at&gt;
> wrote:
> 
>> Hi.
>>
>> Yes, i know this topic is far from new but i'm stuck getting my
>> OL-WFS-Test-Client to work.
>> The basic idea it to get the background from a Mapserver-WMS-Service and
>> plot on this some vector-data from a WFS-Layer (also provided by
>> mapserver).
>>
>> WMS works pretty well but WFS won`t.
>>
>> Before i flood this post with code-samples of my mapfiles and/or the
>> OL-HTML-document i would like to ask if there is a walkthrough where it
>> is
>> shown how to code a correct mapfile and the corresponding OL-Code.
>>
>> Or if one could provide me with a working wfs-mapfile and a matching
>> OL-Code
>> i would be very grateful.
>>
>> Thanks in advance
>> Andy
>>
>> --
>> View this message in context:
>> http://osgeo-org.1803224.n2.nabble.com/Can-t-get-WFS-to-work-tp6504309p6504309.html
>> Sent from the OpenLayers Users mailing list archive at Nabble.com.
>> _______________________________________________
>> Users mailing list
>> Users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>
> 
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
> 


--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Can-t-get-WFS-to-work-tp6504309p6511514.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list