[OpenLayers-Users] OpenLayers Examaple does not work

Andreas Hocevar ahocevar at opengeo.org
Thu Sep 17 11:53:53 EDT 2009


Mario Nuñez Jimenez wrote:
>
> Hello list,
>
> I am trying to get loaded 2 layers, one wms and another wfs but always 
> fails and I don’t know why.
>
> This is the example code “WFS: United States (GeoServer)” taken from 
> http://openlayers.org/dev/examples/ where only I changed the path to 
> .js, .cgi or .css files.
>

As soon as proxy.cgi is running on a different domain than your 
application, you run into the same origin policy restriction. So in your 
snippet, if the proxy runs on gea.atosorigin.es, then your application 
also has to run on gea.atosorigin.es.


Regards,
Andreas.


> It does not works, the wms layer is failing but also the wfs layer… 
> any idea of what I am doing wrongly?
>
> Thank you in advance.
>
>  
>
> <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="OpenLayers-2.8/examples/style.css" 
> type="text/css" />
>
>     <title>WFS: United States (GeoServer)</title>
>
>     <script src="OpenLayers-2.8/OpenLayers.js"></script>
>
>     <script type="text/javascript">
>
>         var map, layer;
>
>  
>
>         function init(){
>
>             
> OpenLayers.ProxyHost="http://gea.atosorigin.es/cgi-bin/proxy.cgi?url=";
>
>             map = new OpenLayers.Map('map', {controls: [ new 
> OpenLayers.Control.PanZoom(), new OpenLayers.Control.Permalink(), new 
> OpenLayers.Control.MouseD$
>
>             layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
>
>                     "http://labs.metacarta.com/wms-c/Basic.py",
>
>                     {layers: 'basic'} );
>
>             map.addLayer(layer);
>
>  
>
>             layer = new OpenLayers.Layer.WFS( "States WFS",
>
>                     "http://sigma.openplans.org/geoserver/ows",
>
>                     { typename: 'topp:states' } );
>
>             map.addLayer(layer);
>
>  
>
>             map.zoomToExtent(new 
> OpenLayers.Bounds(-140.444336,25.115234,-44.438477,50.580078));
>
>         }
>
>     </script>
>
>   </head>
>
>  
>
>   <body onload="init()">
>
> <h1 id="title">WFS United States (GeoServer) Example</h1>
>
>  
>
> <div id="tags">
>
> </div>
>
>  
>
> <p id="shortdesc">
>
>     Shows the use of the WFS United States (GeoServer)
>
> </p>
>
>  
>
> <div id="map" class="smallmap"></div>
>
>  
>
> <div id="docs"></div>
>
>   </body>
>
>  
>
> </html>
>
>  
> ------------------------------------------------------------------
> This e-mail and the documents attached are confidential and intended
> solely for the addressee; it may also be privileged. If you receive
> this e-mail in error, please notify the sender immediately and destroy 
> it.
> As its integrity cannot be secured on the Internet, the Atos Origin
> group liability cannot be triggered for the message content. Although
> the sender endeavours to maintain a computer virus-free network,
> the sender does not warrant that this transmission is virus-free and
> will not be liable for any damages resulting from any virus transmitted.
>
> Este mensaje y los ficheros adjuntos pueden contener informacion 
> confidencial
> destinada solamente a la(s) persona(s) mencionadas anteriormente
> pueden estar protegidos por secreto profesional.
> Si usted recibe este correo electronico por error, gracias por informar
> inmediatamente al remitente y destruir el mensaje.
> Al no estar asegurada la integridad de este mensaje sobre la red, Atos 
> Origin
> no se hace responsable por su contenido. Su contenido no constituye 
> ningun
> compromiso para el grupo Atos Origin, salvo ratificacion escrita por 
> ambas partes.
> Aunque se esfuerza al maximo por mantener su red libre de virus, el 
> emisor
> no puede garantizar nada al respecto y no sera responsable de 
> cualesquiera
> danos que puedan resultar de una transmision de virus.
> ------------------------------------------------------------------
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>   


-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.




More information about the Users mailing list