[Portugal] duvidas sobre openlayers

Hugo hfpmartins gmail.com
Terça-Feira, 13 de Dezembro de 2011 - 07:57:26 EST


Aqui vai.
um abc,

Hugo


map.events.register('zoomend', map, function(){
var mapProj = map.getProjection();
var mapZoom = map.getZoom();
var mapRes = map.getResolutionForZoom(mapZoom);
if (mapProj == 'EPSG:900913' && mapRes > 306){
map.zoomToScale(866688.0326989387, true);
}
});

2011/12/13 Pedro Costa <pedrocostaarma at sapo.pt>

>      Conheces algum exemplo do evento zoomend para eu tentar guiar-me?
>
> Obrigado
>
>
> Em 13-12-2011 12:45, Hugo escreveu:
>
> Experimenta adicionar o seguinte às opções do teu mapa:
>
>  restrictedExtent: new OpenLayers.Bounds(.....);
>
>
>  De qualquer maneira, qd usas layers comerciais (google, yahoo, etc),
> tens que definir tb nas layers algumas restrições nomeadamente as
> resoluções máximas, etc...
>
>  Ou seja, o facto de definires o restricted extent não vai impedir de
> veres o mundo inteiro. Então podes fazer como te disse, ou ainda, podes
> adicionar um evento ao map on zoomend e detectas qual a resolução e se for
> maior que aquela que tu queres permitir entao fazes um zoom ao mapa...
> desta forma consegues eliminar a visualização do mundo inteiro.
>
>  Abc,
>
>  Hugo
>
> 2011/12/13 Pedro Costa <pedrocostaarma at sapo.pt>
>
>>  Obrigado Hugo.
>> Eu estou a tentar que o exemplo do link abra na área que pretendo mas
>> está dificil.
>>
>> http://www.pgrouting.org/docs/ol-workshop/ch05.html
>>
>> Por exemplo, abri o exemplo original fiz zoom na área que pretendo e com
>> o firebug fiz map.getExtent(). Assim obtive os valores da bounding box que
>> queria penso eu:
>>
>> bottom
>>     5066053.4452291
>> left
>>     -929102.37877511
>> right
>>     -921458.67594797
>> top
>>     5070353.0280693
>>
>> A seguir inseri na variavel options coloquei estes valores mas mesmo
>> assim não, abre na área que queria.
>>
>> Alguém tem ideia porquê?
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On 13-12-2011 12:16, Pedro Costa wrote:
>>
>> Pessoal podem ajudar-me no seguinte:
>> Tenho esta parte do código:
>>
>>
>>  var options = {
>>
>>                     projection: new OpenLayers.Projection("EPSG:900913"),
>>
>>                     units: "m",
>>
>>                     numZoomLevels: 22,
>>
>>                     maxResolution: 156543.0339,
>>
>>                     maxExtent: new OpenLayers.Bounds(-20037508, -20037508,
>>
>>                                                      20037508, 20037508.34)
>>
>>                 };
>>
>>
>> retirado de: http://www.pgrouting.org/docs/ol-workshop/ch05.html
>>
>>
>> Significa que o mapa vai estar na projecção 900913. Neste exempo eu quero
>> mudar a area a ser apresentada por isso tenho de mudar o maxExtend certo?
>> A questão é se eu no geoserver definir o srs como 900913 e calcular,
>> tenho os valores da bounding box,e é so substituir ou estou errado?
>>
>> Pelo que percebi:
>>
>> -20037508
>> (left = min X)
>>
>> -20037508
>> (bottom = min y)
>> 20037508
>>
>> (right = max X)
>> 20037508.34
>>
>> (top = max y)
>>
>>
>> Estou correcto?
>>
>> obrigado
>>
>>
>>
>>
>>
>>
>>
>>
>> On 13-12-2011 11:11, Jorge de Jesus wrote:
>>
>>
>> Oi
>>
>> Pelo que vejo:
>>
>> 1) Nao tens a proxy instalada para poderes contactar
>> http://localhost:8080
>>
>>
>> http://trac.osgeo.org/openlayers/wiki/FrequentlyAskedQuestions#HowdoIsetupaProxyHost
>>
>> Ate teres a proxy instalada o browser nao vai pedir nada ao servidor...
>>
>> 2) Tens duas vezes projection:
>> projection: 'map.getProjectionObject()',
>> reproject: 'True',
>> projection: new OpenLayers.Projection('4326'),
>>
>> Geralmente JS usa o ultimo valor definido, portanto estas a usar
>> projeccao 4325
>>
>> 3) O uso correct the OpenLayers.Projection e' com EPSG
>>
>> OpenLayers.Projection("EPSG:4326")
>>
>> All the best
>>
>> Jorge
>>
>>
>> On 13/12/11 10:50, Pedro Costa wrote:
>>
>> Acho que o problema é mesmo os wms que não são reprojectados:
>> Reparem neste exemplo que fiz:
>>
>>
>> http://pastebin.com/6i9TEWsH
>>
>>
>>
>> Simplesmente não aparece o wms
>>
>>
>>
>>
>>
>> On 12-12-2011 09:38, Jorge de Jesus wrote:
>>
>>
>> Bons dias
>>
>>
>> Bem, se tens acerteza que o wms funciona sem problemas  sem o layer
>> proprietario, o mais provavel e' que o WMS nao supporta EPSG:900913 ou gera
>> um erro quando fazes o pedido.
>>
>> No firebug, ve os pedidos feitos pela pagina (Seccao Net) e ve o pedido
>> feito ao servidor e a resposta data.
>>
>> Por exemplo tenho um sistema que faz o seguinte pedido:
>>
>>
>> http://localhost/rasdaman/wms.py?LAYERS=rasdamanImage&FORMAT=image%2Fpng&TIME=2011-06-20&STRATEGIES=%5Bobject%20Object%5D&TRANSPARENT=TRUE&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=EPSG%3A900913&BBOX=-6300637.7833253,4684889.401321,6076045.8348875,10359574.380423&WIDTH=1265&HEIGHT=580
>>
>> Experimenta a fazer um pedido ao teu WMS usando SRS=EPSG%3A900913
>>
>> Jorge
>>
>>
>> On 10/12/11 15:25, Pedro Costa wrote:
>>
>> Jorge,
>>
>> Sim lembro-me.Esclarece-me só a seguinte dúvida, o que é que o browser
>> não está a conseguir ir buscar na tua opinião mais precisamente? É que ele
>> vai buscar o layer proprietário, os wms é que não. Mas noutros exercicios
>> que efectuei sem o layer proprietario ele ia buscar tudo.
>>
>>
>> Obrigado
>> bom fim de semana
>>
>>
>>
>>
>>
>>
>> On 10-12-2011 09:26, Jorge Mendes de Jesus wrote:
>>
>> Oi
>>
>> Parece tudo em ordem, mas tens um ligeiro problema :)
>>
>> Lembras-te da explicacao relativa a cross-domain, ou seja podes acecer a
>> outros URLs partir de Javascript ?! Pois quando tens um url com uma porta
>> diferente tens a mesma situacao, ou seja:
>>
>> http://localhost:8080
>>
>> è um URL differente e tens de usar uma proxy para buscar os resultados.
>> Eu sempre pensei que mesmo com uma porta difererente nao haveria problemas
>> mas à alguns meses algume teve o mesmo problema e foi tudo explicado no
>> mailing list, acho que podes procurar no google pelos emails mais antigos.
>>
>> Alem disso, tens o WMS a funcionar a 100%? Experimentaste a fazer uma
>> pedido com EPSG:900913 ??
>>
>> Jorge
>>
>>
>> -----Original Message-----
>> From: portugal-bounces at lists.osgeo.org on behalf of Pedro Costa
>> Sent: Fri 09/12/2011 13:47
>> To: portugal at lists.osgeo.org
>> Subject: Re: [Portugal] duvidas sobre openlayers
>>
>> On 09-12-2011 09:22, Jorge de Jesus wrote:
>> > No meu caso nao defino a projeccao da camada WMS e o OpenLayers usa a
>> > projeccao da baseLayer da google para tudo, o meu WMS tem suporte
>> > nativo para 900913. Acho que devia ter tido mais atencao ao codigo e
>> > seria mais correcto adicionar a informacao da projeccao
>> >
>> > projection: map.getProjectionObject()
>>
>>
>>
>> Tentei assim:
>>
>> http://pastebin.com/WLkRVbxu
>>
>>
>> Mas continuo sem sucesso, só é visivel o layer proprietário. Nem sequer
>> aparece o "+" do layer switcher, não percebo o porquê...
>>
>> Alguma sugestão?
>>
>> Obrigado
>>
>>
>> PS: O firebug tb não detecta nenhum erro.
>> _______________________________________________
>> Portugal mailing list
>> Portugal at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/portugal
>>
>>
>>
>> _______________________________________________
>> Portugal mailing listPortugal at lists.osgeo.orghttp://lists.osgeo.org/mailman/listinfo/portugal
>>
>>
>>
>> _______________________________________________
>> Portugal mailing listPortugal at lists.osgeo.orghttp://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
>> 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 at pml.ac.ukand 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 listPortugal at lists.osgeo.orghttp://lists.osgeo.org/mailman/listinfo/portugal
>>
>>
>>
>> _______________________________________________
>> Portugal mailing listPortugal at lists.osgeo.orghttp://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
>> 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 at pml.ac.ukand 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 listPortugal at lists.osgeo.orghttp://lists.osgeo.org/mailman/listinfo/portugal
>>
>>
>>
>>
>> _______________________________________________
>> Portugal mailing list
>> Portugal at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/portugal
>>
>>
>
>
>  --
> Hugo Martins
> LabNT - ISEGI UNL
> Campus de Campolide
> 1070-312 Lisboa
> N 38°43'56.84", W 9°9'35.74"
>
>
> _______________________________________________
> Portugal mailing listPortugal at lists.osgeo.orghttp://lists.osgeo.org/mailman/listinfo/portugal
>
>
> _______________________________________________
> Portugal mailing list
> Portugal at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/portugal
>
>


-- 
Hugo Martins
LabNT - ISEGI UNL
Campus de Campolide
1070-312 Lisboa
N 38°43'56.84", W 9°9'35.74"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/portugal/attachments/20111213/b6661cc4/attachment-0001.html


Mais informações acerca da lista Portugal