[Portugal] duvidas sobre openlayers
Pedro Costa
pedrocostaarma sapo.pt
Domingo, 4 de Dezembro de 2011 - 13:00:38 EST
Obrigado MArco. Funcionou adicionando o seguinte:
<style type="text/css">
html, body, #map {
margin: 0;
width: 100%;
height: 100%;
}
</style>
Só mais umas perguntas:
Eu ao adicionar os layers como wms não vai ser possível edita-los
certo?Para permitir edição tem de ser como wfs?
Estou a tentar adicionar uma layer como base, que pode ser por exemplo
do osm mas nunca aparece, apesar de não detectar nenhum erro e aparecer
no layer switcher. Tentei assim:
var base = new OpenLayers.Layer.WMS(
'OpenLayers',
"http://labs.metacarta.com/wms/vmap0",
{layers: 'basic'}
);
Podem recomendar algum basico do genero?
Obrigado
On 04-12-2011 17:46, Marco Afonso wrote:
> Veja o código fonte do exemplo fullscreen do OpenLayers. Podem existir
> outras condicionantes consuante a interpretação do browser...
>
> No dia 4 de Dezembro de 2011 17:30, Pedro Costa
> <pedrocostaarma sapo.pt <mailto:pedrocostaarma sapo.pt>> escreveu:
>
> experimentei nesta parte do html:
>
> <body onload='init();'>
> <h1>Vizela</h1>
> <div id='map' style='width: 1200px; height: 800px;'>
> </div>
>
>
> Mudar a largura e altura para 100% mas não funciona, tem de ser
> noutra parte?
>
>
> Obrigado
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> On 04-12-2011 14:22, Marco Afonso wrote:
>> Viva Pedro,
>>
>> Como fixar o zoom com base numa unica layer de modo a que não
>> seja possivel mover o mapa para além desse mesmo layer?Mesmo
>> que exista outros com áreas superiores.
>>
>>
>> Existem alguns métodos para obter o Extent dos dados da layer em
>> questão, veja em:
>> http://dev.openlayers.org/docs/files/OpenLayers/Layer-js.html#OpenLayers.Layer.getExtent
>>
>> No caso dos WMS, os "dados" devolvidos são apenas imagens, e pode
>> centrar o mapa com recurso a map.setCenter()
>> http://dev.openlayers.org/docs/files/OpenLayers/Map-js.html#OpenLayers.Map.setCenter
>>
>>
>> Adicionando layer como wms/png é possível depois editar (como
>> vectores) e adicionar eventos com base em mouse events?
>>
>>
>> O serviço WMS apenas devolve imagens, não devolve dados
>> vectoriais. É possivel adicionar eventos ao mapa. Procure nos
>> exemplos por events.
>> http://openlayers.org/dev/examples/
>>
>>
>> Devido a ter muitas camadas parte do layer switcher fica
>> oculto como posso resolver este problema sem ter de aumentar
>> ao tamanho da pagina?é possivel fixar-lo no canto superior
>> esquerdo?(mais para cima) e colocar o tamanho das letras mais
>> pequeno?
>>
>>
>> Existem várias formas de custumizar o Layer Switcher. Uma delas é
>> alterar o respectivo CSS; pode ainda criar o seu próprio Layer
>> Switcher.
>> Por exemplo com a framework GeoExt pode criar uma árvore de
>> camadas. http://api.geoext.org/1.0/examples/tree.html
>> Ou simplesmente pode esconder algumas das suas layers utilizando
>> a opção *displayInLayerSwitcher: false;*
>>
>>
>> Como posso ajustar automaticamente o tamanho da janela do
>> openlayers ao tamanho da pagina?
>>
>>
>> Basicamente é definir no CSS a largura e altura da div #map para
>> 100%.
>> http://openlayers.org/dev/examples/fullScreen.html
>>
>>
>>
>> Obrigado
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On 02-12-2011 17:21, Jorge de Jesus wrote:
>>> Oi
>>>
>>> Normalmente uso o Google Earth, a unica chatice eh que tens
>>> de ter o WMS com suporte para o sistema EPSG:900913
>>> (Spherical Mercator), ou entao tens de usar
>>> OpenLayer.Layer.TMS que funciona como uma proxy para o WMS
>>>
>>> Se queres um exemplo ve este site:
>>> http://rsg.pml.ac.uk/wps/example/index.html
>>>
>>> Da uma vista de olhos ao codigo que podes descarregar num
>>> ficheiro comprimido
>>>
>>> Bom fim de semana, eu vou beber umas pints
>>>
>>> Jorge
>>>
>>>
>>> On 02/12/11 17:15, Pedro Costa wrote:
>>>> Pois não tem muita lógica, estou só a testar a ver se
>>>> aprendo alguma coisa :-).
>>>>
>>>> Qual camada é que costumas usar como base layer? Tenho de
>>>> encontrar uma simples...
>>>>
>>>> Obrigado, vou seguir as dicas
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On 02-12-2011 15:31, Jorge de Jesus wrote:
>>>>>
>>>>> Oi
>>>>>
>>>>> Um conselho, tenta usar o pastbin (http://pastebin.com/)
>>>>> assim mandas so um link em vez de uma catrafada de javascript
>>>>>
>>>>> O que se passa em e' que ao selectionares a camada OSM ela
>>>>> fica sobreposta a camada wms_ruas e deixas de ver, o que
>>>>> e' logico :)
>>>>>
>>>>> Talvez a solucao seja adicional as propriedades da camada
>>>>> OSM algum valor de transparencia ('opacity': 0.5)
>>>>>
>>>>> Mas uma pergunta, pelo que vejo tens uma baseLayer que bem
>>>>> de um WMS + uma camada com Ruas, nao consiguo percebe a
>>>>> utilidade da OSM.
>>>>>
>>>>> Nao basta usar a OSM como baseLayer + WMS_ruas ?
>>>>>
>>>>> Normalmente o uso mais comum do OpenLayers e' teres uma
>>>>> image raster e depois em cima varias camadas vectoriais,
>>>>> ja que nas camadas vectoriais e' mais facil de modificar
>>>>> as transparencias de cada objecto
>>>>>
>>>>> Alguem tem mais ideas, sugestoes ?
>>>>> Jorge
>>>>>
>>>>> On 02/12/11 15:20, Pedro Costa wrote:
>>>>>> Tentei assim:
>>>>>>
>>>>>>
>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
>>>>>> "DTD/xhtml1-strict.dtd">
>>>>>> <html xmlns="http://www.w3.org/1999/xhtml"
>>>>>> <http://www.w3.org/1999/xhtml>>
>>>>>> <head>
>>>>>> <title>O meu primeiro mapa</title>
>>>>>> <meta http-equiv="Content-Type" content="text/html;
>>>>>> charset=UTF-8" />
>>>>>> <script src="http://openlayers.org/api/OpenLayers.js"
>>>>>> <http://openlayers.org/api/OpenLayers.js>></script>
>>>>>> <script type="text/javascript">
>>>>>> var map;
>>>>>> function init() {
>>>>>>
>>>>>> var bounds = new OpenLayers.Bounds(
>>>>>> -15699, 188532, -13689, 190828);
>>>>>>
>>>>>> var options = {
>>>>>> controls: [ new
>>>>>> OpenLayers.Control.Navigation(),
>>>>>> new
>>>>>> OpenLayers.Control.PanZoom(),
>>>>>> new
>>>>>> OpenLayers.Control.LayerSwitcher()],
>>>>>> maxExtent: bounds,
>>>>>> maxResolution: 9.61328125
>>>>>> <tel:9.61328125>,
>>>>>> projection: "EPSG:27492",
>>>>>> units: 'm'
>>>>>>
>>>>>> };
>>>>>>
>>>>>> map = new OpenLayers.Map('map', options);
>>>>>> var wms_ruas = new OpenLayers.Layer.WMS(
>>>>>> "ruas",
>>>>>> "http://localhost:8080/geoserver/wms"
>>>>>> <http://localhost:8080/geoserver/wms>,
>>>>>> {'layers': 'Vizela:ruas', 'format':'image/png',
>>>>>> 'transparent':'true',strategies:[new
>>>>>> OpenLayers.Strategy.Fixed()]},
>>>>>> {'opacity': 1.0, 'isBaseLayer': false,
>>>>>> 'visibility': true}
>>>>>> );
>>>>>>
>>>>>>
>>>>>>
>>>>>> var wms_base = new OpenLayers.Layer.WMS(
>>>>>> "base",
>>>>>> "http://localhost:8080/geoserver/wms"
>>>>>> <http://localhost:8080/geoserver/wms>,
>>>>>> {'layers': 'Vizela:base', 'format':'image/png',
>>>>>> 'transparent':'true',strategies:[new
>>>>>> OpenLayers.Strategy.Fixed()]},
>>>>>> {'opacity': 1.0, 'isBaseLayer': true,
>>>>>> 'visibility': true}
>>>>>> );
>>>>>>
>>>>>> var osm_layer = new OpenLayers.Layer.OSM(
>>>>>> 'OpenStreetMap Layer'
>>>>>> );
>>>>>>
>>>>>>
>>>>>> map.addLayers([wms_base,osm_layer,wms_ruas]);
>>>>>> if(!map.getCenter()) {
>>>>>> map.zoomToMaxExtent();
>>>>>> }
>>>>>> }
>>>>>> </script>
>>>>>> </head>
>>>>>> <body onload='init();'>
>>>>>> <h1>Mapa mundo</h1>
>>>>>> <div id='map' style='width: 500px; height: 500px;'>
>>>>>> </div>
>>>>>> </body>
>>>>>> </html>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> E funciona no entanto quando seleciono a camada OSM deixo
>>>>>> de conseguir ver as ruas...Existe alguma propriedade para
>>>>>> mudar isto?Tenho de colocar o layer osm transparente?
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 02-12-2011 14:33, Jorge de Jesus wrote:
>>>>>>> Vou responder a este email e ao outro que mandaste
>>>>>>>
>>>>>>> Nunca trabalhei com OSM, acho que e' uma classe que e'
>>>>>>> herdada de OpenLayers.Layer.XYZ portanto tera as mesmos
>>>>>>> options.
>>>>>>> http://wiki.openstreetmap.org/wiki/OpenLayers_Simple_Example
>>>>>>>
>>>>>>> Podes meter a layer onde quiseres sem grandes problemas,
>>>>>>> ate podes chegar a este ponto:
>>>>>>>
>>>>>>> map.addLayer(new OpenLayers.Layer.OSM());
>>>>>>>
>>>>>>> Eu nao sei o que estas a tentar fazer mas penso que
>>>>>>> queras que OSM seja a baseLayer ? Talvez isto funcione ?
>>>>>>>
>>>>>>> map.addLayer(new
>>>>>>> OpenLayers.Layer.OSM(options={'isBaseLayer':true}));
>>>>>>>
>>>>>>> Quanto ao erro:
>>>>>>>
>>>>>>>
>>>>>>> layer.div is undefined
>>>>>>> layer.div.className="olLayerDiv";layer...ContainerDiv.appendChild(layer.div);}
>>>>>>>
>>>>>>> o problema esta aqui:
>>>>>>>
>>>>>>> map.*addLayer*([wms_ruas, wms_base]);
>>>>>>>
>>>>>>> addLayer --> Adiciona 1 layer e a funcao aceita um Layer
>>>>>>> Object
>>>>>>>
>>>>>>> No teu caso estas a mandar uma lista de layers
>>>>>>>
>>>>>>> Tens de usar o metodo addLayers que aceita uma array com
>>>>>>> layer
>>>>>>>
>>>>>>> map.*addLayers*([wms_ruas, wms_base]);
>>>>>>>
>>>>>>> Agora tudo ao molho (e fe' em Deus) !!!
>>>>>>>
>>>>>>> map.*addLayers*([wms_ruas, wms_base,new
>>>>>>> OpenLayers.Layer.OSM() ]);
>>>>>>>
>>>>>>>
>>>>>>> E tudo por agora mais duvida ?! ^_^
>>>>>>>
>>>>>>> Eu normalmente estou no free.node.irc no canal #pywps
>>>>>>>
>>>>>>> Jorge
>>>>>>>
>>>>>>>
>>>>>>> On 02/12/11 12:51, Pedro Costa wrote:
>>>>>>>> Jorge ajuda-me também no seguinte sff, estou a tentar
>>>>>>>> agora adicionar um layer osm no código em baixo:
>>>>>>>>
>>>>>>>>
>>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0
>>>>>>>> Strict//EN" "DTD/xhtml1-strict.dtd">
>>>>>>>> <html xmlns="http://www.w3.org/1999/xhtml"
>>>>>>>> <http://www.w3.org/1999/xhtml>>
>>>>>>>> <head>
>>>>>>>> <title>O meu primeiro mapa</title>
>>>>>>>> <meta http-equiv="Content-Type" content="text/html;
>>>>>>>> charset=UTF-8" />
>>>>>>>> <script src="http://openlayers.org/api/OpenLayers.js"
>>>>>>>> <http://openlayers.org/api/OpenLayers.js>></script>
>>>>>>>> <script type="text/javascript">
>>>>>>>> var map;
>>>>>>>> function init() {
>>>>>>>>
>>>>>>>> var bounds = new OpenLayers.Bounds(
>>>>>>>> -15699, 188532, -13689, 190828);
>>>>>>>>
>>>>>>>> var options = {
>>>>>>>> controls: [ new
>>>>>>>> OpenLayers.Control.Navigation(),
>>>>>>>> new
>>>>>>>> OpenLayers.Control.PanZoom(),
>>>>>>>> new
>>>>>>>> OpenLayers.Control.LayerSwitcher()],
>>>>>>>> maxExtent: bounds,
>>>>>>>> maxResolution: 9.61328125
>>>>>>>> <tel:9.61328125>,
>>>>>>>> projection: "EPSG:27492",
>>>>>>>> units: 'm'
>>>>>>>>
>>>>>>>> };
>>>>>>>>
>>>>>>>> map = new OpenLayers.Map('map', options);
>>>>>>>> var wms_ruas = new OpenLayers.Layer.WMS(
>>>>>>>> "ruas",
>>>>>>>> "http://localhost:8080/geoserver/wms"
>>>>>>>> <http://localhost:8080/geoserver/wms>,
>>>>>>>> {'layers': 'Vizela:ruas', 'format':'image/png',
>>>>>>>> 'transparent':'true',strategies:[new
>>>>>>>> OpenLayers.Strategy.Fixed()]},
>>>>>>>> {'opacity': 1.0, 'isBaseLayer': true,
>>>>>>>> 'visibility': true}
>>>>>>>> );
>>>>>>>>
>>>>>>>> map.addLayer(wms_ruas);
>>>>>>>> if(!map.getCenter()) {
>>>>>>>> map.zoomToMaxExtent();
>>>>>>>> }
>>>>>>>> }
>>>>>>>> </script>
>>>>>>>> </head>
>>>>>>>> <body onload='init();'>
>>>>>>>> <h1>Mapa mundo</h1>
>>>>>>>> <div id='map' style='width: 500px; height: 500px;'>
>>>>>>>> </div>
>>>>>>>> </body>
>>>>>>>> </html>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Mas sinceramente não sei bem onde o inserir, já tentei
>>>>>>>> em vários locais e não funciona.POdes ajudar?
>>>>>>>> Estava a tentar adicionando o seguinte:
>>>>>>>>
>>>>>>>> var osm_layer = new OpenLayers.Layer.OSM(
>>>>>>>> 'OpenStreetMap Layer'
>>>>>>>> );
>>>>>>>>
>>>>>>>>
>>>>>>>> Abraço
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On 02-12-2011 12:37, Jorge de Jesus wrote:
>>>>>>>>> Ok parece que o assunto esta resolvido
>>>>>>>>>
>>>>>>>>> On 02/12/11 11:42, Pedro Costa wrote:
>>>>>>>>>> Consegui resolver...Tinha de mudar postgis para o
>>>>>>>>>> nome da store que tinha e já funciona:-)
>>>>>>>>>>
>>>>>>>>>> Obrigado pessoal
>>>>>>>>>> Vou continuar o estudo
>>>>>>>>>>
>>>>>>>>>> ABraço
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> -------- Original Message --------
>>>>>>>>>> Subject: Re: [Portugal] duvidas sobre openlayers
>>>>>>>>>> Date: Fri, 02 Dec 2011 11:26:55 +0000
>>>>>>>>>> From: Pedro Costa <pedrocostaarma sapo.pt>
>>>>>>>>>> <mailto:pedrocostaarma sapo.pt>
>>>>>>>>>> To: Jorge de Jesus <jmdj pml.ac.uk>
>>>>>>>>>> <mailto:jmdj pml.ac.uk>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Obrigado Jorge. Já eliminei os erros no entanto o
>>>>>>>>>> openlayers não está a carregar o layer ruas, a página
>>>>>>>>>> abre mas sem eu conseguir ver o layer.
>>>>>>>>>>
>>>>>>>>>> Tentei wms_ruas.getExtent() no firebug e obtenho o
>>>>>>>>>> seguinte erro: ReferenceError: wms_ruas is not defined.
>>>>>>>>>> Penso que não está a conseguir ir buscar o layer ao
>>>>>>>>>> geoserver, alguma segestão do que poderá ser?
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Obrigado pelas repostas de todos
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On 02-12-2011 09:32, Jorge de Jesus wrote:
>>>>>>>>>>> On 02/12/11 00:37, Pedro Costa wrote:
>>>>>>>>>>>> Pessoal podem ajudar-me também nas seguintes dúvidas:
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Eu tenho o html que segue em baixo, quando o abro,
>>>>>>>>>>>> o firebug indica um erro assim:
>>>>>>>>>>>>
>>>>>>>>>>>> OpenLayers is not defined
>>>>>>>>>>>> var bounds = new OpenLayers.Bounds(
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>> "OpenLayers is not defined" acho que este e' o error
>>>>>>>>>>> que tens, parece que a pagina nao carregou o
>>>>>>>>>>> OpenLayers.js. Ve no tab "Net">js do firefox se
>>>>>>>>>>> ele carregou o OpenLayers, experimenta usar a versao
>>>>>>>>>>> online:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> <script type="text/javascript"
>>>>>>>>>>> src="http://openlayers.org/dev/OpenLayers.js"
>>>>>>>>>>> <http://openlayers.org/dev/OpenLayers.js>></script>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Eu experimentei: var bounds = new
>>>>>>>>>>> OpenLayers.Bounds(-23941, 208039,-21480, 210148);
>>>>>>>>>>>
>>>>>>>>>>> E esta tudo OK
>>>>>>>>>>>
>>>>>>>>>>> Quanto aos bounds, experimenta meter os bounds
>>>>>>>>>>> iguais aos descritos no WMS (faz um pedido
>>>>>>>>>>> getCapabilites), depois de teres adicionado o a
>>>>>>>>>>> layer wms_ruas, podes usar wms_ruas.getExtent():
>>>>>>>>>>>
>>>>>>>>>>> map.zoomToExtent(wms_ruas.getExtent());
>>>>>>>>>>>
>>>>>>>>>>> So uma chamada de atencao o object wms_ruas so esta
>>>>>>>>>>> totalmante operacional depois de adicionado ao mapa
>>>>>>>>>>> e depois de feito o pedido ao servico pelo
>>>>>>>>>>> openlayers, ate teres o objecto totalmente criado
>>>>>>>>>>> certas variaveis e metodos dao error.
>>>>>>>>>>>
>>>>>>>>>>> Jorge
>>>>>>>>>>>
>>>>>>>>>>>> Penso que seja porque os bounds estão mal
>>>>>>>>>>>> definidos. A minha dúvida é o seguinte, como posso
>>>>>>>>>>>> saber os bounds correctos? E em que src tenho de os
>>>>>>>>>>>> escrever?Igual ao src do layer que quero ir
>>>>>>>>>>>> buscar?Será que funciona se eu executar no firebug
>>>>>>>>>>>> map.zoomToMaxExtent e map.getExtent no layer
>>>>>>>>>>>> preview do geoserver?
>>>>>>>>>>>>
>>>>>>>>>>>> Tentei isso e dá-me os valores: topp right left e
>>>>>>>>>>>> bottom, mas porque ordem os escrevo?
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Podem tirar-me estas dúvidas?
>>>>>>>>>>>>
>>>>>>>>>>>> Obrigado
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>>>>>>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0
>>>>>>>>>>>> Strict//EN" "DTD/xhtml1-strict.dtd">
>>>>>>>>>>>> <html xmlns="http://www.w3.org/1999/xhtml"
>>>>>>>>>>>> <http://www.w3.org/1999/xhtml>>
>>>>>>>>>>>> <head>
>>>>>>>>>>>> <title>O meu primeiro mapa</title>
>>>>>>>>>>>> <meta http-equiv="Content-Type" content="text/html;
>>>>>>>>>>>> charset=UTF-8" />
>>>>>>>>>>>> <script src="/openlayers/lib/OpenLayers.js"
>>>>>>>>>>>> type="text/javascript"></script>
>>>>>>>>>>>> <script type="text/javascript">
>>>>>>>>>>>> var map;
>>>>>>>>>>>> function init() {
>>>>>>>>>>>>
>>>>>>>>>>>> var bounds = new OpenLayers.Bounds(
>>>>>>>>>>>> -23941, 208039,
>>>>>>>>>>>> -21480, 210148
>>>>>>>>>>>> );
>>>>>>>>>>>>
>>>>>>>>>>>> var options = {
>>>>>>>>>>>> controls: [ new
>>>>>>>>>>>> OpenLayers.Control.Navigation(),
>>>>>>>>>>>> new
>>>>>>>>>>>> OpenLayers.Control.PanZoom(),
>>>>>>>>>>>> new
>>>>>>>>>>>> OpenLayers.Control.LayerSwitcher()],
>>>>>>>>>>>> maxExtent: bounds,
>>>>>>>>>>>> maxResolution: 9.61328125
>>>>>>>>>>>> <tel:9.61328125>,
>>>>>>>>>>>> projection: "EPSG:27492",
>>>>>>>>>>>> units: 'm'
>>>>>>>>>>>>
>>>>>>>>>>>> };
>>>>>>>>>>>>
>>>>>>>>>>>> map = new OpenLayers.Map('map',
>>>>>>>>>>>> options);
>>>>>>>>>>>> var wms = new OpenLayers.Layer.WMS(
>>>>>>>>>>>> 'OpenLayers WMS',
>>>>>>>>>>>>
>>>>>>>>>>>> 'http://localhost:8080/geoserver/wms', {
>>>>>>>>>>>> layers: 'topp:ruas'
>>>>>>>>>>>> }, {} );
>>>>>>>>>>>> map.addLayer(wms);
>>>>>>>>>>>> if(!map.getCenter()) {
>>>>>>>>>>>> map.zoomToMaxExtent();
>>>>>>>>>>>> }
>>>>>>>>>>>> }
>>>>>>>>>>>> </script>
>>>>>>>>>>>> </head>
>>>>>>>>>>>> <body onload='init();'>
>>>>>>>>>>>> <h1>Mapa mundo</h1>
>>>>>>>>>>>> <div id='map' style='width: 500px; height: 500px;'>
>>>>>>>>>>>> </div>
>>>>>>>>>>>> </body>
>>>>>>>>>>>> </html>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On 01-12-2011 13:22, Jorge de Jesus wrote:
>>>>>>>>>>>>> Algumas respostas peco desculpas pelo email meio
>>>>>>>>>>>>> algarviado
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> On 01/12/11 12:41, Pedro Costa wrote:
>>>>>>>>>>>>>> Pessoal será que podiam ajudar-me com as
>>>>>>>>>>>>>> seguintes dúvidas do openlayeres, as dúvidas são
>>>>>>>>>>>>>> relativas ao exemplo disponivel aqui:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> http://geobox.geospot.pt/pt/index.php/Edi%C3%A7%C3%A3o_com_OpenLayers
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> *1) O que sgnificam estas diferentes partes do
>>>>>>>>>>>>>> código:*
>>>>>>>>>>>>>> <link rel="stylesheet" href="/openlayers/theme/default/style.css" type="text/css" />
>>>>>>>>>>>>>>
>>>>>>>>>>>>> Isto e' un link pro CSS (cascade style sheet) que
>>>>>>>>>>>>> define como varios elementos vao ser rendizados
>>>>>>>>>>>>> (rendered), ou seja cores, tipos de letras icons,
>>>>>>>>>>>>> e onde os menus (exemplo: LayerSwitcher) vao
>>>>>>>>>>>>> aparecer etc. Da uma vista de olhos ao ficheiro e
>>>>>>>>>>>>> experimenta a fazer alteracoes :) .Se nao sabes
>>>>>>>>>>>>> trabalhar com CSS da uma vista de olhos a:
>>>>>>>>>>>>> http://www.w3schools.com/css/
>>>>>>>>>>>>>> OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url=";
>>>>>>>>>>>>>>
>>>>>>>>>>>>> Aiiiiiii a santa bendita proxy !!! Da uma vista de
>>>>>>>>>>>>> olhos aqui:
>>>>>>>>>>>>> http://trac.osgeo.org/openlayers/wiki/FrequentlyAskedQuestions#ProxyHost
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> Basicamente em Javascript tu nao podes chamar um
>>>>>>>>>>>>> URL que nao esteja no mesmo dominio, por exemplo
>>>>>>>>>>>>> se o teu site esta em http://localhost mas o WFS
>>>>>>>>>>>>> esta em http://WFSsite.pt o codigo de javascipript
>>>>>>>>>>>>> nao pode aceder a http://WFSsite.pt, esta situacao
>>>>>>>>>>>>> eh conhecida por "cross domain" da uma vista de
>>>>>>>>>>>>> olhos na internet
>>>>>>>>>>>>>
>>>>>>>>>>>>> Actualmente os browsers mais recentes podem
>>>>>>>>>>>>> contactar outros dominios se o servidor no outro
>>>>>>>>>>>>> dominio suportar a norma CORS:
>>>>>>>>>>>>> http://www.leggetter.co.uk/2010/03/12/making-cross-domain-javascript-requests-using-xmlhttprequest-or-xdomainrequest.html
>>>>>>>>>>>>>
>>>>>>>>>>>>> Basicamente, a melhor estrategia eh de instalar a
>>>>>>>>>>>>> proxy no teu servidor e deixar que o openlayers
>>>>>>>>>>>>> trate do assunto.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Normalmente, o firebug manda-te um erro quando
>>>>>>>>>>>>> tens cross-domain (normalmente o browser nao diz
>>>>>>>>>>>>> nada e nao faz nada quando tens cross-domain)
>>>>>>>>>>>>>> *2) Porquê é que aqui a classe map é nula?*
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> var map=null; Bem uns gostam cozido outros gosta
>>>>>>>>>>>>> de assado :0 eh so um estilo de programacao, se
>>>>>>>>>>>>> usares var map; vai dar ao mesmo. Uma chamada de
>>>>>>>>>>>>> atencao, o var map=null; esta fora da funcao
>>>>>>>>>>>>> init(), quer dizer que eh uma variable global, que
>>>>>>>>>>>>> pode ser acedida por qualquer funcao. Normalmente
>>>>>>>>>>>>> um erro comum e' meter "var map" dentro do init()
>>>>>>>>>>>>>
>>>>>>>>>>>>> Pessoalmente meto o map e as layers sempre fora da
>>>>>>>>>>>>> funcao de inicializacao, ja que variaveis globais
>>>>>>>>>>>>> parecem logo no firebug.
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>> var map = null;
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> *3) NO exemplo em questão que segue em baixo, temos de por o schema para o layer do geoserver em questão, trata-se de
>>>>>>>>>>>>>> um url? Como posso descobrir url para o layer que pretendo? Tentei trocar o nome deste exemplo (participante)
>>>>>>>>>>>>>> por um layer que tenho e colar no browser mas não abre nada...
>>>>>>>>>>>>>> POdem dar-me uma dicas?
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> *
>>>>>>>>>>>>>
>>>>>>>>>>>>> Eu raramente trabalho com WFS e estive a ver no
>>>>>>>>>>>>> codigo do openlayers (Protocol/WFS/v1.js) temos a
>>>>>>>>>>>>> seguinte definicao da propriedade schema:
>>>>>>>>>>>>>
>>>>>>>>>>>>> /**
>>>>>>>>>>>>> * Property: schema
>>>>>>>>>>>>> * {String} Optional schema location that will
>>>>>>>>>>>>> be included in the
>>>>>>>>>>>>> * schemaLocation attribute value. Note
>>>>>>>>>>>>> that the feature type schema
>>>>>>>>>>>>> * is required for a strict XML validator
>>>>>>>>>>>>> (on transactions with an
>>>>>>>>>>>>> * insert for example), but is *not*
>>>>>>>>>>>>> required by the WFS specification
>>>>>>>>>>>>> * (since the server is supposed to know
>>>>>>>>>>>>> about feature type schemas).
>>>>>>>>>>>>> */
>>>>>>>>>>>>> schema: null,
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> Basicamente e' um URL que define o schema dos
>>>>>>>>>>>>> dados em XML e que pode ser usado para validar os
>>>>>>>>>>>>> conteudos, no exemplo passas um
>>>>>>>>>>>>> DescribeFeatureType que gera un esquema que define
>>>>>>>>>>>>> a estrutura do XML dos teus dados. Em varios
>>>>>>>>>>>>> exemplos nunca vi o uso do schema:
>>>>>>>>>>>>>
>>>>>>>>>>>>> http://workshops.opengeo.org/stack-intro/openlayers.html
>>>>>>>>>>>>>
>>>>>>>>>>>>> Eu uso mais mapserver, ja que nao me dou muito bem
>>>>>>>>>>>>> com o JAVA (serei demasiado calhau?)
>>>>>>>>>>>>>
>>>>>>>>>>>>>> *
>>>>>>>>>>>>>> 4)Quando devo utilizar a livraria do openlayers no localhost e quando devo utilizar a online?Tanto faz ou quais as vantagens
>>>>>>>>>>>>>> de um e de outro?
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Obrigado
>>>>>>>>>>>>>> Bom feriado a todos
>>>>>>>>>>>>>> *
>>>>>>>>>>>>> uma livraria no localhost e' mais rapida para
>>>>>>>>>>>>> fazer o upload e nao estas dependente de "terceiros"
>>>>>>>>>>>>>
>>>>>>>>>>>>> E para concluir: O firebug e' o melhor amigo do
>>>>>>>>>>>>> Homem (depois do cao e' claro)
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> Bom feriado, eu vou marfar
>>>>>>>>>>>>>
>>>>>>>>>>>>> Jorge
>>>>>>>>>>>>>
>>>>>>>>>>>>> --
>>>>>>>>>>>>> PGP public key: 0x595FF9D3
>>>>>>>>>>>>>
>>>>>>>>>>>>> ------------------------------------------------------------------------
>>>>>>>>>>>>>
>>>>>>>>>>>>> Plymouth Marine Laboratory
>>>>>>>>>>>>> Registered Office:
>>>>>>>>>>>>> Prospect Place
>>>>>>>>>>>>> The Hoe
>>>>>>>>>>>>> Plymouth PL1 3DH
>>>>>>>>>>>>>
>>>>>>>>>>>>> Website: www.pml.ac.uk <http://www.pml.ac.uk>
>>>>>>>>>>>>> Click here for PML Annual Review
>>>>>>>>>>>>> <http://www.pml.ac.uk/pdf/PMLAR2010.pdf>
>>>>>>>>>>>>> Registered Charity No. 1091222
>>>>>>>>>>>>> PML is a company limited by guarantee
>>>>>>>>>>>>> registered in England & Wales
>>>>>>>>>>>>> company number 4178503
>>>>>>>>>>>>>
>>>>>>>>>>>>> Please think before you print.
>>>>>>>>>>>>>
>>>>>>>>>>>>> ------------------------------------------------------------------------
>>>>>>>>>>>>>
>>>>>>>>>>>>> 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 forinfo pml.ac.uk
>>>>>>>>>>>>> <mailto:forinfo pml.ac.uk> 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.
>>>>>>>>>>>>>
>>>>>>>>>>>>> ------------------------------------------------------------------------
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>> PGP public key: 0x595FF9D3
>>>>>>>>>>>
>>>>>>>>>>> ------------------------------------------------------------------------
>>>>>>>>>>>
>>>>>>>>>>> Plymouth Marine Laboratory
>>>>>>>>>>> Registered Office:
>>>>>>>>>>> Prospect Place
>>>>>>>>>>> The Hoe
>>>>>>>>>>> Plymouth PL1 3DH
>>>>>>>>>>>
>>>>>>>>>>> Website: www.pml.ac.uk <http://www.pml.ac.uk>
>>>>>>>>>>> Click here for PML Annual Review
>>>>>>>>>>> <http://www.pml.ac.uk/pdf/PMLAR2010.pdf>
>>>>>>>>>>> Registered Charity No. 1091222
>>>>>>>>>>> PML is a company limited by guarantee
>>>>>>>>>>> registered in England & Wales
>>>>>>>>>>> company number 4178503
>>>>>>>>>>>
>>>>>>>>>>> Please think before you print.
>>>>>>>>>>>
>>>>>>>>>>> ------------------------------------------------------------------------
>>>>>>>>>>>
>>>>>>>>>>> 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
>>>>>>>>>>> forinfo pml.ac.uk <mailto:forinfo pml.ac.uk> 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
>>>>>>>>>> Portugal lists.osgeo.org <mailto:Portugal lists.osgeo.org>
>>>>>>>>>> http://lists.osgeo.org/mailman/listinfo/portugal
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> PGP public key: 0x595FF9D3
>>>>>>>>>
>>>>>>>>> ------------------------------------------------------------------------
>>>>>>>>>
>>>>>>>>> Plymouth Marine Laboratory
>>>>>>>>> Registered Office:
>>>>>>>>> Prospect Place
>>>>>>>>> The Hoe
>>>>>>>>> Plymouth PL1 3DH
>>>>>>>>>
>>>>>>>>> Website: www.pml.ac.uk <http://www.pml.ac.uk>
>>>>>>>>> Click here for PML Annual Review
>>>>>>>>> <http://www.pml.ac.uk/pdf/PMLAR2010.pdf>
>>>>>>>>> Registered Charity No. 1091222
>>>>>>>>> PML is a company limited by guarantee
>>>>>>>>> registered in England & Wales
>>>>>>>>> company number 4178503
>>>>>>>>>
>>>>>>>>> Please think before you print.
>>>>>>>>>
>>>>>>>>> ------------------------------------------------------------------------
>>>>>>>>>
>>>>>>>>> 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
>>>>>>>>> forinfo pml.ac.uk <mailto:forinfo pml.ac.uk> 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.
>>>>>>>>>
>>>>>>>>> ------------------------------------------------------------------------
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> PGP public key: 0x595FF9D3
>>>>>>>
>>>>>>> ------------------------------------------------------------------------
>>>>>>>
>>>>>>> Plymouth Marine Laboratory
>>>>>>> Registered Office:
>>>>>>> Prospect Place
>>>>>>> The Hoe
>>>>>>> Plymouth PL1 3DH
>>>>>>>
>>>>>>> Website: www.pml.ac.uk <http://www.pml.ac.uk>
>>>>>>> Click here for PML Annual Review
>>>>>>> <http://www.pml.ac.uk/pdf/PMLAR2010.pdf>
>>>>>>> Registered Charity No. 1091222
>>>>>>> PML is a company limited by guarantee
>>>>>>> registered in England & Wales
>>>>>>> company number 4178503
>>>>>>>
>>>>>>> Please think before you print.
>>>>>>>
>>>>>>> ------------------------------------------------------------------------
>>>>>>>
>>>>>>> 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 forinfo pml.ac.uk
>>>>>>> <mailto:forinfo pml.ac.uk> 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.
>>>>>>>
>>>>>>> ------------------------------------------------------------------------
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> PGP public key: 0x595FF9D3
>>>>>
>>>>> ------------------------------------------------------------------------
>>>>>
>>>>> Plymouth Marine Laboratory
>>>>> Registered Office:
>>>>> Prospect Place
>>>>> The Hoe
>>>>> Plymouth PL1 3DH
>>>>>
>>>>> Website: www.pml.ac.uk <http://www.pml.ac.uk>
>>>>> Click here for PML Annual Review
>>>>> <http://www.pml.ac.uk/pdf/PMLAR2010.pdf>
>>>>> Registered Charity No. 1091222
>>>>> PML is a company limited by guarantee
>>>>> registered in England & Wales
>>>>> company number 4178503
>>>>>
>>>>> Please think before you print.
>>>>>
>>>>> ------------------------------------------------------------------------
>>>>>
>>>>> 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 forinfo pml.ac.uk
>>>>> <mailto:forinfo pml.ac.uk> 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.
>>>>>
>>>>> ------------------------------------------------------------------------
>>>>>
>>>>>
>>>>
>>>
>>>
>>> --
>>> PGP public key: 0x595FF9D3
>>>
>>> ------------------------------------------------------------------------
>>>
>>> Plymouth Marine Laboratory
>>> Registered Office:
>>> Prospect Place
>>> The Hoe
>>> Plymouth PL1 3DH
>>>
>>> Website: www.pml.ac.uk <http://www.pml.ac.uk>
>>> Click here for PML Annual Review
>>> <http://www.pml.ac.uk/pdf/PMLAR2010.pdf>
>>> Registered Charity No. 1091222
>>> PML is a company limited by guarantee
>>> registered in England & Wales
>>> company number 4178503
>>>
>>> Please think before you print.
>>>
>>> ------------------------------------------------------------------------
>>>
>>> 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 forinfo pml.ac.uk
>>> <mailto:forinfo pml.ac.uk> 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
>> Portugal lists.osgeo.org <mailto:Portugal lists.osgeo.org>
>> http://lists.osgeo.org/mailman/listinfo/portugal
>>
>>
>>
>>
>> _______________________________________________
>> Portugal mailing list
>> Portugal lists.osgeo.org <mailto:Portugal lists.osgeo.org>
>> http://lists.osgeo.org/mailman/listinfo/portugal
>
>
> _______________________________________________
> Portugal mailing list
> Portugal lists.osgeo.org <mailto:Portugal lists.osgeo.org>
> http://lists.osgeo.org/mailman/listinfo/portugal
>
>
>
>
> _______________________________________________
> Portugal mailing list
> Portugal lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/portugal
-------------- próxima parte ----------
Um anexo em HTML foi limpo...
URL: http://lists.osgeo.org/pipermail/portugal/attachments/20111204/fdb37b3c/attachment-0001.html
Mais informações acerca da lista Portugal