[OpenLayers-Users] Cannot see Geoserver Vector Layer With WFS Protocol

Roald de Wit list at rdewit.net
Wed Oct 12 23:46:23 EDT 2011


Hi,

You are requesting data from a domain that is different from yours. 
You'll need to use a proxy script.
There is some more info about this requirement in the OpenLayers FAQ:
http://trac.osgeo.org/openlayers/wiki/FrequentlyAskedQuestions#ProxyHost

Regards, Roald

On 13/10/11 11:11, McGee, David wrote:
> Hi List,
> I'm very new to OpenLayers, and would greatly appreciate help with 
> what I'm doing wrong.  I cannot get vector layers sourced from 
> Geoserver to display using the WFS Protocol. Please see the example below.
> Thanks in advance,
> David McGee
> <!DOCTYPE html>
> <html>
> <head>
> <title>WFS Visibility</title>
> <link rel="stylesheet" 
> href="http://www.openlayers.org/dev/examples/style.css" type="text/css">
> <script src="http://www.openlayers.org/dev/OpenLayers.js"></script 
> <http://www.openlayers.org/dev/OpenLayers.js%22%3E%3C/script>>
> <script type="text/javascript">
>         function init(){
>             var map = new OpenLayers.Map( 'map' );
>             var base = new OpenLayers.Layer.WMS( "WMS base",
>                 "http://vmap0.tiles.osgeo.org/wms/vmap0",
>                     {
>          layers: "basic",
>       transparent: "true",
>       format: "image/png"
>      },
>      {isBaseLayer: true, visibility: true}
>     );
>     var poi_wfs = new OpenLayers.Layer.Vector("poi WFS", {
>         strategies: [new OpenLayers.Strategy.BBOX()],
>      protocol: new OpenLayers.Protocol.WFS ({
>          url: "http://demo.opengeo.org/geoserver/wfs",
>       featureType: "poi",
>       featureNS: "http://www.census.gov",
>       srsName: "EPSG:4326",
>       version: "1.1.0"
>       })
>     });
>    map.addLayers([base,poi_wfs]);
>    map.addControl(new OpenLayers.Control.LayerSwitcher());
>             map.zoomToMaxExtent();
>         }
> </script>
> </head>
> <body onload="init()">
> <div id="map" class="smallmap"></div>
> </body>
> </html>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20111013/3fb750d9/attachment-0001.html


More information about the Users mailing list