O OpenLayers.ProxyHost so tem de ser configurado se estas a aceder a um a web service que esteja num outro server quando tens tudo em localhost nao necessitas de Proxyhost
Nao sei que a ponto estao habituados a fazer desenvolvimento em Javascript mas aconselho a usar a extensao firebug to firefox http://getfirebug.com/ dar uma vista de olhos aos tutoriais e depois usar o firebug para ver o que o servidor esta a mandar e tb ver se existe algo dentro do var wfslayer O openlayers costuma ter bugs um pouco estranhos mas o mailing list do Openlayers eh do melhor :) Jorge On 12/01/11 13:28, Fernando Quadro wrote: > Jorge, > > De uma olhada no seguinte tutorial, acredito q te ajude: > > http://www.fernandoquadro.com.br/html/2009/03/05/configurando-o-proxyhost-no-openlayers/ > > Abraço, > > Fernando Quadro > http://www.fernandoquadro.com.br > twitter.com/fernandoquadro > > On Wed, 12 Jan 2011 12:06:28 +0000, Jorge Penedo <[email protected]> > wrote: >> 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 [1]", >> { >> 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 [2]", >> { >> >> 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 >> [3]", >> //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 [4] >> >> >> >> Se colocar o URL, no browser: >> >> > http://localhost:8080/geoserver/wfs?request=GetFeature&version=1.1.0&typeName=testes:VivendaCasa&outputFormat=GML2 >> [5] >> >> este retorna o XML sem problemas >> >> >> >> Alguém já foi confrontado por este tipo de erro? >> >> Cumps Jorge Penedo >> >> Links: >> ------ >> [1] http://localhost:8080/geoserver/wms >> [2] http://localhost:8080/geoserver/wms >> [3] http://localhost:8080/geoserver/wfs >> [4] http://localhost/apps/OpenLayers-2.10/OpenLayers.js >> [5] >> > http://localhost:8080/geoserver/wfs?request=GetFeature&version=1.1.0&typeName=testes:VivendaCasa&outputFormat=GML2 > -------------------------------------------------------------------------------- Plymouth Marine Laboratory Registered Office: Prospect Place The Hoe Plymouth PL1 3DH Website: www.pml.ac.uk Registered Charity No. 1091222 PML is a company limited by guarantee registered in England & Wales company number 4178503 -------------------------------------------------------------------------------- This e-mail, its content and any file attachments are confidential. If you have received this e-mail in error please do not copy, disclose it to any third party or use the contents or attachments in any way. Please notify the sender by replying to this e-mail or e-mail [email protected] and then delete the email without making any copies or using it in any other way. The content of this message may contain personal views which are not the views of Plymouth Marine Laboratory unless specifically stated. You are reminded that e-mail communications are not secure and may contain viruses. Plymouth Marine Laboratory accepts no liability for any loss or damage which may be caused by viruses. -------------------------------------------------------------------------------- _______________________________________________ Portugal mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/portugal
