[OSGeo-Brasil] Problema - tabelas com OpenLayers

João Paulo Saboia awulll em gmail.com
Quarta Novembro 17 10:11:45 EST 2010


Pessoal, estou com problemas em visualizar tabelas de feições com o
OpenLayers.
No console de erros não aparece nada, nem erro algum aparece na página,
simplesmente nada acontece.

O código é este:


<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"
/>
        <style type="text/css">
            table.featureInfo, table.featureInfo td, table.featureInfo th {
                border: 1px solid #ddd;
                border-collapse: collapse;
                margin: 0;
                padding: 0;
                font-size: 90%;
                padding: .2em .1em;
            }

            table.featureInfo th {
                padding: .2em .2em;
                text-transform: uppercase;
                font-weight: bold;
                background: #eee;
            }

            table.featureInfo td {
                background: #fff;
            }

            table.featureInfo tr.odd td {
                background: #eee;
            }

            table.featureInfo caption {
                text-align: left;
                font-size: 100%;
                font-weight: bold;
                text-transform: uppercase;
                padding: .2em .2em;
            }
        </style>
        <script src="http://openlayers.org/api/OpenLayers.js"></script>
        <script type="text/javascript">
            var pureCoverage = false;

            function init()
            {
                var format = 'image/png';

                var bounds = new OpenLayers.Bounds( -124.73, 24.96,
                                                     -66.97, 49.37 );

                var options =
                {
                    maxExtent: bounds,
                    maxResolution: 0.22,
                    projection: "EPSG:4326",
                    units: 'degrees'
                };

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

                var wms = new OpenLayers.Layer.WMS("State Boundaries","
http://localhost:8080/geoserver/wms",
                                                   {

                        layers: 'topp:states',
                        styles: '',
                        srs: 'EPSG:4326',
                        format: format
                    },
                    {singleTile: true, ratio: 1}

                                                  );
                map.addLayer(wms);
                map.zoomToExtent(bounds);
                map.events.register('click', map, function (e)
                {
                    OpenLayers.Util.getElement('nodelist').innerHTML =
"Loading... please wait...";
                    var url = wms.getFullRequestString(
                    {
                        REQUEST: "GetFeatureInfo",
                        EXCEPTIONS: "application/vnd.ogc.se_xml",
                        BBOX: wms.map.getExtent().toBBOX(),
                        X: e.xy.x,
                        Y: e.xy.y,
                        INFO_FORMAT: 'text/plain',
                        QUERY_LAYERS: wms.params.LAYERS,
                        FEATURE_COUNT: 50,
                        Layers: 'topp:states',
                        Styles: '',
                        Srs: 'EPSG:4326',
                        WIDTH: wms.map.size.w,
                        HEIGHT: wms.map.size.h,
                    });
                    OpenLayers.loadURL(url,'',this,setHTML);
                    OpenLayers.Event.stop(e);
                });
                function setHTML(response){
                    OpenLayers.Util.getElement('nodelist').innerHTML =
response.responseText;

                };
            }





        </script>

    </head>

    <body onload="init()">
        <div style="width: 60%; height: 70%; border: 1px solid blue;"
id="map"></div>
        <div id="nodelist">
            <em>Clique no mapa para obter informações das feições</em>
        </div>
    </body>

</html>


Estou usando o Geoserver aqui também. O layer adicionado é um daqueles
padrão que vem com o Geoserver. Quando vou em Layer Preview consigo ver as
tabelas ao clicar no mapa, mas com o meu código não. Nem mesmo se eu pegar o
código fonte gerado pelo Layer Preview e salvar num .htm consigo ver as
tabelas.
Fiz alguma idiotice?
Desde já obrigado.

João Paulo
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: http://lists.osgeo.org/pipermail/brasil/attachments/20101117/e0af887a/attachment.html


Mais detalhes sobre a lista de discussão Brasil