[OpenLayers-Users] custom getFeatureInfo control / problem with layer pixels

Mario Nuñez Jimenez mario.nunez at atosresearch.eu
Fri Feb 15 03:34:01 PST 2013


Hello Gery,

I appreciate your help,

But what I want to do is to deal with the pixel problem, I mean to know which conversion is needed… I understand I could inherit and modify Openlayers GetFeatureInfo object as you said, but my intention here is also learn and understand this issue.

Cheers,

 

Mario Núñez Jiménez

 

GEO Lab

Enviroment Sector

Energy & Utilities Market

 

Research & Innovation

 

 

 

T +34 912148100

F +34 917543252

mario.nunez at atosresearch.eu

mario.nunez at atos.net

 

Calle Albarracin 25

(28037) Madrid, Spain

 

 

From: Gery . [mailto:gamejihou at hotmail.com] 
Sent: viernes, 15 de febrero de 2013 12:31
To: Mario Nuñez Jimenez
Cc: openlayers-users at lists.osgeo.org
Subject: Re: [OpenLayers-Users] custom getFeatureInfo control / problem with layer pixels

 

Hola Mario,

 

You have to start with this to create your own control:

 

OpenLayers.Control.mygetFeatureInfo = OpenLayers.Class(OpenLayers.Control.getFeatureInfo,{ 
            // put here the things you need to add or change from the original control
}); 





This is a complete approach (I think) if you want to overwrite or change the whole original control: http://stackoverflow.com/questions/9810684/openlayers-updating-initialize-method-of-class-call





Also this link can give you an idea: http://osgeo-org.1560.n6.nabble.com/Order-Priority-of-Control-GetFeature-and-Control-WMSGetFeatureInfo-on-click-td4997282.html

 

About the pixel stuff, you can control that with tolerance, that's in pixels if remember well, I use 10 pixels and works great.

 

So you need to pick on the map and then show some kind of inset map like the permalink control? If you need messages saying "you click here or there, inside or outside, etc...", you can use mapserver with templates or simply geoext popup: http://api.geoext.org/1.1/examples/popup.html





Cheers,





Gery

Sent from my iBath


On Feb 15, 2013, at 11:14, "Mario Nuñez Jimenez" <mario.nunez at atosresearch.eu> wrote:

Hello Gery,
I am just trying to do my own getFeatureInfo control by capturing the click on map event.

The problem is to fit the x and y pixels from the click event on the x and y needed to do a getfeatureinfo request  to my wms.

The idea is that the X and Y from the event are taken from the viewport/base layer (the complete picture shown in the map) but I need to do a get feature info request about other layer loaded in the map, a smaller map shown over the base layer (it only occupies a small area).

Every time I want to use the X and Y that I get from the event I have a result from my getfeatureinfo request even If I clicked out that layer area, so it's a nonsense since it should replied with some kind of "you are out of the layer extension so there is no data were you clicked".  Also if I cliked in a subarea of my layer the result of the getfeatureinfo request says "you clicked in area Z" but I didn't clicked in subarea Z, so I think the X and Y should be related to the layer you are querying  but I don't know how to do that.

Cheers,
Mario.

-----Original Message-----
From: Gery . [mailto:gamejihou at hotmail.com] 
Sent: jueves, 14 de febrero de 2013 20:45
To: Mario Nuñez Jimenez
Cc: openlayers-users at lists.osgeo.org
Subject: Re: [OpenLayers-Users] custom getFeatureInfo control / problem with layer pixels

I've recently tested the openlayers.control.getfeature to do something related to your question but sorry to say this, I didn't understand what you're trying to do.

Sent from my iBath

On Feb 14, 2013, at 19:12, "negroscuro" <mario.nunez at atosresearch.eu> wrote:

Hello,
I am trying to do a customized getFeatureInfo, so in order to do the request to the WMS I need to know the I and J defined in the OGC WMS 1.3.0 specification, I mean to do the getFeatureInfo request i need a I and J, being those I and J pixels of the layer.

If I am not wrong, when I implemented a control to handle the click on map event, I get a X and Y pixels but those pixels I guess that dont match the layers ones because that x and y from the event are based in the viewport extension and not in a concrete layer extension so my question here is how to get the choosen layer X and Y when I click on it or just get some null value to know that I am clicking outside my concrete layer.

I know which layer is selected but I dont know how to convert the vieport x and y clicked in that layer's X and Y pixels.

Do I explained myself clearly enough?
Sorry for my english.
Thank you in advance for helping
Cheers.



--
View this message in context: http://osgeo-org.1560.n6.nabble.com/custom-getFeatureInfo-control-problem-with-layer-pixels-tp5034389.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users
------------------------------------------------------------------
This e-mail and the documents attached are confidential and intended 
solely for the addressee; it may also be privileged. If you receive 
this e-mail in error, please notify the sender immediately and destroy it. 
As its integrity cannot be secured on the Internet, the Atos 
group liability cannot be triggered for the message content. Although 
the sender endeavours to maintain a computer virus-free network, 
the sender does not warrant that this transmission is virus-free and 
will not be liable for any damages resulting from any virus transmitted. 

Este mensaje y los ficheros adjuntos pueden contener informacion confidencial 
destinada solamente a la(s) persona(s) mencionadas anteriormente 
pueden estar protegidos por secreto profesional. 
Si usted recibe este correo electronico por error, gracias por informar 
inmediatamente al remitente y destruir el mensaje. 
Al no estar asegurada la integridad de este mensaje sobre la red, Atos 
no se hace responsable por su contenido. Su contenido no constituye ningun 
compromiso para el grupo Atos, salvo ratificacion escrita por ambas partes. 
Aunque se esfuerza al maximo por mantener su red libre de virus, el emisor 
no puede garantizar nada al respecto y no sera responsable de cualesquiera 
danos que puedan resultar de una transmision de virus. 
------------------------------------------------------------------

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130215/2d57b97d/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 816 bytes
Desc: image001.gif
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130215/2d57b97d/attachment-0002.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.gif
Type: image/gif
Size: 78 bytes
Desc: image002.gif
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130215/2d57b97d/attachment-0003.gif>


More information about the Users mailing list