[Spanish] Problema de Openlayers con Firefox 9 - Tema ProxyHost

Antonio Santiago asantiagop at gmail.com
Thu Jan 12 17:22:29 EST 2012


Debes estar cerca, todo pinta bastante bien :)

Como cargas el fichero curso1.html en el navegador? como
file:///xxxxxxx/curso1.html o como http://localhost/curso1.html?

Si es con el primero entonces prueba con el segundo.

Animo.


2012/1/12 Javier Jose Quispe Varillas <jjquispev at hotmail.com>

>  Amigos
> Gracias por todos sus comentarios.
> He estado haciendo pruebas y pienso que he avanzado algo:
>
> 1) Tengo instalado el ms4w en c:\ms4w
> 2) Ya instale el python 2.7 en mi pc, en c:\Python27
> 3) El archivo proxy.cgi modifique la primera linea con:
>     Estaba: #!/usr/bin/env python
>     ahora esta: #!C:/Python27/python.exe -u
> 4) Cuando en un browser indico: http://localhost/cgi-bin/proxy.cgi, sale
> la pagina de openalyers. al parecer ya esta bien el cgi.
> 5) Cree una carpeta c:\ms4w\apps\cursoopenlayers
> 6) Copie en un carpeta todas las librerias de openalyers en
> c:\ms4w\apps\openlayers\openlayers
> 7) Tengo el siguiente archivo curso1.html :
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
>     <head>
>         <meta http-equiv="Content-Type" content="text/html;
> charset=utf-8"/>
>         <script type="text/javascript"
> src="openlayers/lib/OpenLayers.js"></script>
>         <script type="text/javascript">
>             var map;
>             //OpenLayers.ProxyHost =
> "c:\ms4w\Apache\cgi-bin\proxy.cgi?url=";
>             OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url=";
>             //OpenLayers.ProxyHost = "\cgi-bin\proxy.cgi?url=";
>             function init() {
>                 map = new OpenLayers.Map('map');
>
>                 /*var layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
>                     "http://vmap0.tiles.osgeo.org/wms/vmap0", {layers:
> 'basic'} );
>                 map.addLayer(layer);
>                 map.setCenter(new OpenLayers.LonLat(-8, 42.8), 8);
>                 map.addControl(new OpenLayers.Control.LayerSwitcher());
>                 */
>
>                 var base = new OpenLayers.Layer.WMS("Capa base",
>                     "http://tilecache.osgeo.org/wms-c/Basic.py",
>                     {layers: "basic"}
>                 );
>                 map.addLayer(base);
>                 var wfs = new OpenLayers.Layer.Vector("Capa WFS", {
>                     strategies: [new OpenLayers.Strategy.Fixed()],
>                     protocol: new OpenLayers.Protocol.WFS({
>                         url: "http://demo.opengeo.org/geoserver/wfs",
>                         featureType: "states"
>                         //featureNS: "http://www.openplans.org/topp"
>                     })
>                 });
>                 map.addLayer(wfs);
>                 map.zoomToExtent(new OpenLayers.Bounds(-140.4, 25.1,
> -44.4, 50.5));
>
>                 // CONTROLES
>                 map.addControl(new OpenLayers.Control.Navigation());
>                 map.addControl(new OpenLayers.Control.Attribution());
>                 map.addControl(new OpenLayers.Control.PanZoomBar());
>                 map.addControl(new OpenLayers.Control.ArgParser());
>                 map.addControl(new
> OpenLayers.Control.LayerSwitcher({'ascending':false}));
>                 map.addControl(new OpenLayers.Control.Permalink());
>                 map.addControl(new OpenLayers.Control.MousePosition());
>                 map.addControl(new OpenLayers.Control.OverviewMap());
>                 map.addControl(new OpenLayers.Control.KeyboardDefaults());
>                 map.addControl(new OpenLayers.Control.ScaleLine());
>
>                 var vector_layer = new OpenLayers.Layer.Vector( "Editable"
> );
>                 var edit_panel = new
> OpenLayers.Control.EditingToolbar(vector_layer);
>                 var modify_feature_ctrl = new
> OpenLayers.Control.ModifyFeature(vector_layer,
>                 {
>                     title: "Modify Feature",
>                     displayClass: "olControlModifyFeature"
>                 });
>                 edit_panel.addControls(modify_feature_ctrl);
>                 map.addControl(edit_panel);
>                 map.addLayer(vector_layer);
>
>                 /*  // No selecciona parece que falta algo
>                 getFeature_control = new OpenLayers.Control.GetFeature({
>                     protocol: OpenLayers.Protocol.WFS.fromWMSLayer(base),
>                     box: true,
>                     hover: false,
>                     multipleKey: "shiftKey",
>                     toggleKey: "ctrlKey"
>                 });
>                 getFeature_control.events.register("featureselected",
> this, function(e) {
>                     select_layer.addFeatures([e.feature]);
>                     modify_control.deactivate();
>                 });
>                 getFeature_control.events.register("featureunselected",
> this, function(e) {
>                     select_layer.removeFeatures([e.feature]);
>                 });
>                 map.addControl(getFeature_control);
>                 getFeature_control.activate();*/
>
>                 /*var popup;     // Sale mas o menos, no sale data, hay
> que ajustar algo
>                 info = new OpenLayers.Control.WMSGetFeatureInfo({
>                     url: 'http://tilecache.osgeo.org/wms-c/Basic.py',
>                     title: 'Identify features by clicking',
>                     queryVisible: true,
>                     eventListeners: {
>                         getfeatureinfo: function(event) {
>                         if (popup !== undefined) {
>                             map.removePopup(popup);
>                         }
>                         popup = new OpenLayers.Popup.FramedCloud(
>                             "chicken",
>                             map.getLonLatFromPixel(event.xy),
>                             new OpenLayers.Size(50,50),
>                             event.text,
>                             null, true );
>                         map.addPopup(popup);
>                         }
>                     }
>                 });
>                 map.addControl(info);
>                 info.activate();*/
>
>                 /* //Create a Format object
>                 var vector_format = new OpenLayers.Format.GeoJSON({});
>                 var vector_protocol = new OpenLayers.Protocol.HTTP({
>                     url: 'ex5_data.json',
>                     format: vector_format
>                 });
>                 var vector_strategies = [new OpenLayers.Strategy.Fixed()];
>                 //Create a vector layer that contains a Format, Protocol,
> and Strategy class
>                 vector_layer = new OpenLayers.Layer.Vector('More Advanced
> Vector Layer',{
>                         protocol: vector_protocol,
>                         strategies: vector_strategies
>                     });
>                 map.addLayer(vector_layer);^*/
>
>                 /*
>
>                 var feature_data = {
>                     "type": "FeatureCollection",
>                     "features": [
>                         {"type":"Feature","properties":{},
>                             "geometry":{"type":"Point",
> "coordinates":[-81, 42]}},
>                         {"type":"Feature","properties":{},
>                             "geometry":{"type":"Point",
> "coordinates":[-82, 43]}},
>                         {"type":"Feature","properties":{},
>                             "geometry":{"type":"Point",
> "coordinates":[-80, 41]}},
>                         {"type":"Feature","properties":{},
>                             "geometry":{"type":"Point", "coordinates":[19,
> -24]}},
>                         {"type":"Feature","properties":{},
>                             "geometry":{"type":"Point", "coordinates":[4,
> 42]}},
>                         {"type":"Feature","properties":{},
>                             "geometry":{"type":"Point", "coordinates":[32,
> 35]}},
>                     ]
>                 }
>
>                 var poligono1 = new OpenLayers.Feature.Vector(
>                     //We'll make a polygon from a linear ring object,
> which consists of points
>                     new OpenLayers.Geometry.Polygon(new
> OpenLayers.Geometry.LinearRing(
>                     [new OpenLayers.Geometry.Point(-124.2, 41.9),
>                     new OpenLayers.Geometry.Point(-120.1, 41.9),
>                     new OpenLayers.Geometry.Point(-120, 39),
>                     new OpenLayers.Geometry.Point(-114.5, 34.9),
>                     new OpenLayers.Geometry.Point(-114.7, 32.7),
>                     new OpenLayers.Geometry.Point(-117.1, 32.5),
>                     new OpenLayers.Geometry.Point(-120, 34),
>                     new OpenLayers.Geometry.Point(-123.7, 38.4)
>                     //We won't pass in the first point, the polygon will
> close automatically
>                     ]
>                     )),
>                 {
>                     'location': 'Fanghorn Forest',
>                     'description': 'Land of the Ents'
>                 }
>                 );
>                 // Create a format object
>                 var format_geojson = new OpenLayers.Format.GeoJSON({});
>                 //Create an array of strategy objects
>                 var vector_strategies = [new
> OpenLayers.Strategy.Cluster({distance:42})];
>                 //Create a vector layer that contains a Format, Protocol,
> and Strategy class
>                 var vector_layer1 = new OpenLayers.Layer.Vector('More
> Advanced Vector Layer',{
>                     strategies: vector_strategies
>                 });
>                 //Load in the data
>
> vector_layer1.addFeatures(format_geojson.read(feature_data));
>                 map.addLayer(vector_layer1);
>
>                 */
>
>             }
>
>         </script>
>         <style type="text/css">
>             #map {
>                 width: 600px;
>                 height: 400px;
>                 border: 1px solid;
>             }
>         </style>
>         <title>Curso de OpenLayers - Ejemplo 1 - Capas WMS</title>
>     </head>
>     <body onload="init()">
>         <h1 id="title">Curso de OpenLayers - Ejemplo 1 - Capas WMS</h1>
>         <div id="map">
>         </div>
>     </body>
> </html>
>
> ubicado en c:\ms4w\apps\cursoopenlayers\curso1.html
>
> 8) Cuando ejecuto dicho html en IE 8 me sale el error:
>
>     Mensaje: Acceso denegado.
>
>     Línea: 105
>     Carácter: 13
>     Código: 0
>     URI:
> file:///C:/ms4w/apps/cursoopenlayers/openlayers/lib/OpenLayers/Request/XMLHttpRequest.js
>
>
>    Y cuando ejecuto en Firefox 9 con Firebug me sale en la consola:
>
>    Access to restricted URI denied
>    oRequest._object.send(oRequest._data);
> XMLHttpRequest.js (línea 220)
>
>
> ---------------------------------------------------------------------------------------------------
>
>    En el IE 8 no se ve nada, pero en Firefox 9 se ve la capa WMS, por lo
> que supongo que el problema es la capa WFS.
>
>    Que me falta para que salga bien?
>
>    Al parecer al lanzar el html no encuentra al proxy.cgi, me falta
> configurar algo mas?
>
> Mis disculpas si es algo facil, pero he estado tratando toda la tarde y
> revisando en internet.
>
> Espero su ayuda al respecto.
>
> Javier Quispe
>
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> Spanish mailing list
> http://lists.osgeo.org/mailman/listinfo/spanish
> http://es.osgeo.org
> http://twitter.com/osgeoes
>
>


-- 
|----------------------------------------------------------------
| Web Page: http://www.acuriousanimal.com
| Blog: http://www.acuriousanimal.com/blog
| Twitter: @acanimal <http://twitter.com/#%21/acanimal>
|----------------------------------------------------------------
| A crazy mix site: http://www.astracanada.net
| Old Virtual Globe project:http://theballoonproject.blogspot.com
|----------------------------------------------------------------
|   _      __
|  /_)    (_ ` _   _  _)_ o  _   _   _
| / /  o .__) (_( ) ) (_  ( (_( (_( (_)
|                                 _)
|----------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/spanish/attachments/20120112/e24384cc/attachment-0001.html


More information about the Spanish mailing list