[OpenLayers-Users] GeoServer Proxy Extension OpenLayers

stash steffen.schwarz85 at googlemail.com
Mon Nov 16 14:20:02 EST 2009




Andreas Hocevar-2 wrote:
> 
> 
> Only if you provide more context:
> 
> * the code of the example you are trying to run
> * the url you are accessing it through
> 
> 

Hello,
yes I think this is the best idea to solve my problem. I use the following
code. It's a wms (my base layer) with a background card and a wfs with some
points located somewhere in denmark.

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <link rel="stylesheet" href="OpenLayers-2.8/theme/default/style.css"
type="text/css" />
    <link rel="stylesheet" href="style.css" type="text/css" />
    <script src="OpenLayers-2.8/lib/OpenLayers.js"></script>
    <script type="text/javascript">
        var map, layer;

        function init(){
            OpenLayers.ProxyHost="/geoserver/rest/proxy?url=";

 var max_Extent = new OpenLayers.Bounds(
                    -198, -98.68117980957031,
                    198, 92.30477600097656
                );

                var bounds = new OpenLayers.Bounds(
                    1, 45,
                    16, 60
                );
                
                var options = {
                    controls: [],
                    maxExtent: max_Extent,
                    maxResolution: 0.5,
                    projection: "EPSG:4326",
                    units: 'degrees'

                };

                map = new OpenLayers.Map('map', options);


            layer = new OpenLayers.Layer.WMS( "OpenLayers WMS", 
            "http://localhost:8080/geoserver/wms", {layers: 'topp:country'}
);
            map.addLayer(layer);

            layer = new OpenLayers.Layer.WFS( "Owl Survey",
                "http://localhost:8080/geoserver/wfs",
                {typename: "topp:MY_GAZETTEER", maxfeatures: 10},
                { featureClass: OpenLayers.Feature.WFS});
            map.addLayer(layer);
            map.addControl(new OpenLayers.Control.LayerSwitcher());
            
map.zoomToExtent(bounds);
        }
    </script>
  </head>
  <body onload="init()">
    <h1 id="title">WFS Points</h1>
    <p id='shortdesc'>
      Using a Layer.WFS with a featureClass, one can take in XML data
      from a WFS class and display it any way you like.
    </p>  
    <div id="map" class="smallmap"></div>
  </body>
</html>

The wms is working, the wfs not. My browser (Internet explorer) tells me an
error at the xmlhttprequest (Access denied).

Thanks for your help.

Best regards
stash

-- 
View this message in context: http://n2.nabble.com/GeoServer-Proxy-Extension-OpenLayers-tp3998936p4014088.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list