[OpenLayers-Users] Strange behaviour after panning
Pedro Simonetti
pedrosimonetti at gmail.com
Tue Apr 8 22:28:24 EDT 2008
After some investigations, I found how to fix it.
I've changed the piece of the code where it calculates the coordinates,
from:
var lonlat = map.getLonLatFromLayerPx(evt.xy);
To:
var lonlat = map.getLonLatFromViewPortPx(evt.xy);
Now it works fine.
I'm just wondering, what's the difference of "getLonLatFromLayerPx", and
"getLonLatFromViewPortPx"? I've looked at the docs but I still don't get it.
At first glance, I thought that these methods were similars.
my best regards,
Pedro Simonetti.
Pedro Simonetti wrote:
>
> Dear developers,
>
> I'm trying to develop a query feature in my project, but I'm getting a
> strange behaviour. I'm using 2 kaMap layers, one raster satellite image,
> and one vector shape file.
>
> Please visit:
>
> http://189.52.176.118:8080/teste/?zoom=5&lat=7756661.87151&lon=364887.48481&layers=BT
>
> Then click in the map inside the polygon named "Jardim da Penha". Note
> that the query will result the right response, showing the text "Jardim da
> Penha" in the lower right corner of the screen.
>
> But, then, click and drag, moving the mouse to the right. And then click
> on another polygon, for example, the named "Itarare". The result will be
> wrong. Here I got "Jardim da Penha", but clicking in other areas you will
> got different results.
>
> It seems when you pan the map, it looses the correct coordinates. It's
> like the "map.getLonLatFromLayerPx" still thinking it is in the same
> coordinates that before panning.
>
> What I'm doing wrong??
>
> I have limited english skills, so if my message isn't clear enought,
> please ask me about specific details.
>
> I'm using the 2.6 RC1. I'm making the query through PHP mapscript.
>
> NOTE: The images i'm using are very big, and my development server is
> kinda slow. So, if the images don't load properly, please press F5, and
> they should appear.
>
> regards,
>
> Pedro.
>
--
View this message in context: http://www.nabble.com/Strange-behaviour-after-panning-tp16575710p16578138.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list