[Portugal] Erro ao ler WFS gerado no Geoserver 2.0.2 no OpenLayers 2.10

Jorge Penedo jorge.penedo at gmail.com
Wed Jan 12 07:06:28 EST 2011


Sendo novato em OpenSource, comecei por fazer as minhas experiências, na
disponibilização de conteúdos no formato WMS.
Chegando o momento de tentar a disponibilizalção de conteúdos em WFS surge a
seguinte dificuldade:

Não aparece qualquer informação no mapa, do layers  wfs.


O código utilizado no Js.



var map;
OpenLayers.ProxyHost = "proxy.cgi?url=";


function init() {



 bounds = new OpenLayers.Bounds(-52000.0,-185000.0,-48000.0,-180000.0);


  var options = {
                    maxExtent: bounds,
                    maxResolution: 100.64726562499999,
                    projection: "EPSG:27493",

                    units: 'm',
     zoom: 48
         };

   map = new OpenLayers.Map("mapa",options)

/*

Imagem de base em WMS

*/

var base = (new OpenLayers.Layer.WMS(
                    " Foto 10K", "http://localhost:8080/geoserver/wms",
                    {
                        width: '512',
                        srs: 'EPSG:27493',
                        layers: 'testes:FotoSTC'
                     },{

                    buffer: 0
                } ));


/*

Informação que se pretende obter, aqui em WMS - Funciona-

*/
 var Vivenda = new OpenLayers.Layer.WMS(
                    "Vivendas)",
                     "http://localhost:8080/geoserver/wms",
                    {

                        layers: [
     "testes:VivendaCasa",

    ],
    format: "image/gif",
    srs: 'EPSG:27493',
    transparent: true

                     },{
                    isBaseLayer: false,

                    buffer: 0
                }
   );

 /*

definição do protocolo entre Openlayers e o Geoserver

*/

  var wfslayer = new OpenLayers.Layer.Vector("WFS", { strategies: [new
OpenLayers.Strategy.BBOX()],
  protocol: new OpenLayers.Protocol.WFS({
              url: "http://localhost:8080/geoserver/wfs",
  //service:"WFS",
   //version: "1.1.0" ,
  request:"GetFeature",
  version: "1.1.0" ,
                typeName: "testes:VivendaCasa",

  OutputFormat:"GML2"
   }) });

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


  map.addLayer(base);
  map.addLayer(wfslayer);
   map.addLayer(Vivenda);
   map.zoomToExtent(bounds)

}

 O erro que surge no Browser é:



Mensagem: 'this.featureType.length' é nulo ou não é um objecto
Linha: 1026
Caráct: 447
Código: 0
URL: http://localhost/apps/OpenLayers-2.10/OpenLayers.js



Se colocar o URL, no browser:

*
http://localhost:8080/geoserver/wfs?request=GetFeature&version=1.1.0&typeName=testes:VivendaCasa&outputFormat=GML2
*

** * este retorna o XML sem problemas*

**

Alguém já foi confrontado por este tipo de erro?

*Cumps Jorge Penedo*
-------------- próxima parte ----------
Um anexo em HTML foi limpo...
URL: http://lists.osgeo.org/pipermail/portugal/attachments/20110112/eaab711c/attachment.html


More information about the Portugal mailing list