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