[OpenLayers-Users] Trouble with an example of openlayers!!!

Raul David Orozco hagen1113 at yahoo.com
Mon Jul 27 12:36:10 EDT 2009


Hi to everyone. 
I'm new in the world of openlayers. I've been working with it for a few days, reading some documentation and specially using the examples found in the official page of openlayers. Everything fine until I tried to use this example: 

http://openlayers.org/dev/examples/getfeatureinfo-popup.html

My project involves do something just like that, but when I use this example locally in my pc (downloaded and modified only in the url of openlayer script) the popups of the features aren't shown and I get this error code:

Error: uncaught exception: [Exception... "Access to restricted URI denied"  code: "1012" nsresult: "0x805303f4 (NS_ERROR_DOM_BAD_URI)"  location: "http://openlayers.org/api/OpenLayers.js Line: 1078"]
Archivo de origen: http://openlayers.org/api/OpenLayers.js
Línea: 225

This is the code:

**********************************************************************************************************
<html>
  <head>
    <title>GetFeatureInfo Popup</title>
    <script src="http://openlayers.org/api/OpenLayers.js"></script>
    <link rel="stylesheet" href="http://openlayers.org/theme/default/style.css" type="text/css" />
    <link rel="stylesheet" href="style.css" type="text/css" />
    <script>
    OpenLayers.ProxyHost = "proxy.cgi?url=";
    
    var map, info;
    
    function load() {
        map = new OpenLayers.Map({
            div: "map",
            maxExtent: new OpenLayers.Bounds(143.834,-43.648,148.479,-39.573)
        });

        var political = new OpenLayers.Layer.WMS("State Boundaries",
            "http://demo.opengeo.org/geoserver/wms", 
            {'layers': 'topp:tasmania_state_boundaries', transparent: true, format: 'image/gif'},
            {isBaseLayer: true}
        );

        var roads = new OpenLayers.Layer.WMS("Roads",
            "http://demo.opengeo.org/geoserver/wms", 
            {'layers': 'topp:tasmania_roads', transparent: true, format: 'image/gif'},
            {isBaseLayer: false}
        );

        var cities = new OpenLayers.Layer.WMS("Cities",
            "http://demo.opengeo.org/geoserver/wms", 
            {'layers': 'topp:tasmania_cities', transparent: true, format: 'image/gif'},
            {isBaseLayer: false}
        );

        var water = new OpenLayers.Layer.WMS("Bodies of Water",
            "http://demo.opengeo.org/geoserver/wms", 
            {'layers': 'topp:tasmania_water_bodies', transparent: true, format: 'image/gif'},
            {isBaseLayer: false}
        );

        var highlight = new OpenLayers.Layer.Vector("Highlighted Features", {
            displayInLayerSwitcher: false, 
            isBaseLayer: false 
        });
        
        map.addLayers([political, roads, cities, water, highlight]); 

        info = new OpenLayers.Control.WMSGetFeatureInfo({
            url: 'http://demo.opengeo.org/geoserver/wms', 
            title: 'Identify features by clicking',
            queryVisible: true,
            eventListeners: {
                getfeatureinfo: function(event) {
                    map.addPopup(new OpenLayers.Popup.FramedCloud(
                        "chicken", 
                        map.getLonLatFromPixel(event.xy),
                        null,
                        event.text,
                        null,
                        true
                    ));
                }
            }
        });
        map.addControl(info);
        info.activate();

        map.addControl(new OpenLayers.Control.LayerSwitcher());
        map.zoomToMaxExtent();
    }

  </script>
  </head>

  <body onload="load()">
      <h1 id="title">Feature Info in Popup</h1>

      <div id="tags"></div>

      <p id="shortdesc">
        Demonstrates the WMSGetFeatureInfo control for fetching information
        about a position from WMS (via GetFeatureInfo request).  Results
        are displayed in a popup.
      </p>

      <div id="map" class="smallmap"></div>

    <div id="docs"></div>
  </body>
</html>
**********************************************************************************************************

Thanks to anyone who can help me. Bye



      ____________________________________________________________________________________
¡Obtén la mejor experiencia en la web!
Descarga gratis el nuevo Internet Explorer 8. 
http://downloads.yahoo.com/ieak8/?l=e1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090727/0a857922/attachment.html


More information about the Users mailing list